Commit 859d87ab authored by Loïck Bonniot's avatar Loïck Bonniot

[p][t] Add document hash in launchSignature

parent af61496c
Pipeline #1758 passed with stage
This diff is collapsed.
......@@ -136,12 +136,14 @@ message LaunchSignature {
ErrorCode errorCode = 1;
/// The unique signature generated by the platform for this specific signature attempt
string signatureUuid = 2;
/// The SHA-512 hash of the contract document
bytes documentHash = 3;
/// A confirmation of client hashes for communication authentication
repeated bytes keyHash = 3;
repeated bytes keyHash = 4;
/// The signing sequence generated on-the-fly by the platform
repeated uint32 sequence = 4;
/// The cryptographic object of the signature of this structure (hash and errorCode excepted) by the platform, for data certification.
repeated uint32 sequence = 5;
/// The cryptographic object of the signature of this structure (seal and errorCode excepted) by the platform, for data certification.
/// The signature is computed using auth.SignStructure function:
/// PKCS1v15 + SHA512 hash of the string representation of the structure
bytes seal = 5;
bytes seal = 6;
}
......@@ -14,10 +14,11 @@ import (
// readySignal is the structure that is transmitted accross goroutines
type readySignal struct {
ready bool // If true, this is the ready signal. If not, this is a new connection signal
data string // Various data (CN or SignatureUUID)
chain [][]byte // Only used to broadcast hash chain (signers hashes in order)
sequence []uint32 // Only used to broadcast signature sequence
ready bool // If true, this is the ready signal. If not, this is a new connection signal
data string // Various data (CN or SignatureUUID)
documentHash []byte // Contract document SHA-512 hash
chain [][]byte // Only used to broadcast hash chain (signers hashes in order)
sequence []uint32 // Only used to broadcast signature sequence
}
// ReadySign is the last job of the platform before the signature can occur.
......@@ -56,6 +57,7 @@ func ReadySign(db *mgdb.MongoManager, rooms *common.WaitingGroupMap, ctx *contex
return &api.LaunchSignature{
ErrorCode: &api.ErrorCode{Code: api.ErrorCode_SUCCESS},
SignatureUuid: s.data,
DocumentHash: s.documentHash,
KeyHash: s.chain,
Sequence: s.sequence,
}
......@@ -110,10 +112,11 @@ func masterReadyRoutine(db *mgdb.MongoManager, rooms *common.WaitingGroupMap, co
ready := FindAndUpdatePendingSigner(cn, &signersReady, &contract.Signers)
if ready {
rooms.Broadcast(roomID, &readySignal{
ready: true,
data: bson.NewObjectId().Hex(),
chain: contract.GetHashChain(),
sequence: GenerateSignSequence(len(contract.Signers)),
ready: true,
data: bson.NewObjectId().Hex(),
documentHash: contract.File.Hash,
chain: contract.GetHashChain(),
sequence: GenerateSignSequence(len(contract.Signers)),
})
work = false
}
......
......@@ -146,6 +146,7 @@ func IsPlatformSealValid(promise *cAPI.Promise) bool {
theoric := pAPI.LaunchSignature{
SignatureUuid: promise.Context.SignatureUUID,
DocumentHash: promise.Context.ContractDocumentHash,
KeyHash: promise.Context.Signers,
Sequence: promise.Context.Sequence,
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment