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
......@@ -261,14 +261,16 @@ type LaunchSignature struct {
ErrorCode *ErrorCode `protobuf:"bytes,1,opt,name=errorCode" json:"errorCode,omitempty"`
// / The unique signature generated by the platform for this specific signature attempt
SignatureUuid string `protobuf:"bytes,2,opt,name=signatureUuid" json:"signatureUuid,omitempty"`
// / The SHA-512 hash of the contract document
DocumentHash []byte `protobuf:"bytes,3,opt,name=documentHash,proto3" json:"documentHash,omitempty"`
// / A confirmation of client hashes for communication authentication
KeyHash [][]byte `protobuf:"bytes,3,rep,name=keyHash,proto3" json:"keyHash,omitempty"`
KeyHash [][]byte `protobuf:"bytes,4,rep,name=keyHash,proto3" json:"keyHash,omitempty"`
// / The signing sequence generated on-the-fly by the platform
Sequence []uint32 `protobuf:"varint,4,rep,name=sequence" json:"sequence,omitempty"`
// / The cryptographic object of the signature of this structure (hash and errorCode excepted) by the platform, for data certification.
Sequence []uint32 `protobuf:"varint,5,rep,name=sequence" json:"sequence,omitempty"`
// / 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
Seal []byte `protobuf:"bytes,5,opt,name=seal,proto3" json:"seal,omitempty"`
Seal []byte `protobuf:"bytes,6,opt,name=seal,proto3" json:"seal,omitempty"`
}
func (m *LaunchSignature) Reset() { *m = LaunchSignature{} }
......@@ -618,50 +620,51 @@ var _Platform_serviceDesc = grpc.ServiceDesc{
}
var fileDescriptor0 = []byte{
// 710 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x94, 0x55, 0x5f, 0x6f, 0x12, 0x4b,
0x14, 0x67, 0x81, 0x16, 0x38, 0x14, 0xba, 0x19, 0x7a, 0xef, 0xe5, 0x92, 0xd4, 0x34, 0x13, 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xae, 0x71, 0xe3, 0xad, 0xd4, 0xd9, 0xa8, 0x1c, 0x17,
0x50, 0x0f, 0xca, 0x4a, 0xc0, 0xc8, 0xd6, 0x3b, 0x39, 0x2d, 0x77, 0x5a, 0x6b, 0x08, 0x89, 0x44,
0xe5, 0x81, 0xc7, 0x00, 0xb3, 0x90, 0x99, 0x34, 0x90, 0x00, 0x2a, 0x55, 0x6e, 0x01, 0x7f, 0x09,
0x7b, 0x79, 0x9d, 0xa2, 0xb6, 0x8e, 0xd8, 0x22, 0xdd, 0x2d, 0x67, 0x9f, 0x43, 0x3d, 0x27, 0x35,
0xf4, 0x9f, 0x0e, 0xf8, 0x53, 0x7c, 0x9d, 0x86, 0xde, 0x30, 0x5e, 0x79, 0xf0, 0x14, 0x1a, 0x6b,
0x5a, 0x41, 0xff, 0xeb, 0x88, 0x6d, 0xfa, 0xe9, 0xa0, 0x6c, 0x2a, 0x33, 0x25, 0xe0, 0xc2, 0x89,
0x25, 0x0b, 0xaf, 0x65, 0x03, 0x84, 0xfe, 0x49, 0x89, 0x58, 0x1f, 0xa8, 0x4e, 0xc2, 0xf0, 0xc6,
0xb8, 0xe0, 0xc2, 0xc7, 0x5d, 0xfd, 0x61, 0x78, 0xfa, 0x3b, 0x00, 0x00, 0xff, 0xff, 0xc9, 0x55,
0xd0, 0xdf, 0x39, 0x06, 0x00, 0x00,
// 723 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x94, 0x55, 0xef, 0x6e, 0xd3, 0x30,
0x10, 0x6f, 0xda, 0xac, 0x7f, 0xae, 0x6b, 0x17, 0xb9, 0x03, 0x42, 0xa5, 0xa1, 0xc9, 0x42, 0x62,
0x42, 0xa8, 0x9d, 0x8a, 0x04, 0x82, 0x6f, 0x5d, 0xa9, 0xb6, 0xa1, 0x51, 0x26, 0xb7, 0x05, 0x89,
0x6f, 0x21, 0xf1, 0xd6, 0xb0, 0x36, 0x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x4c, 0x29, 0x72, 0x64, 0xa9, 0x9d, 0x8c, 0xde, 0xdb, 0xad, 0x1c, 0x42, 0x2c, 0x63, 0x71, 0xe0,
0x29, 0xc0, 0x34, 0x88, 0x74, 0x1a, 0x88, 0x01, 0xa5, 0x72, 0xb7, 0x80, 0xbf, 0x86, 0xdd, 0xac,
0x96, 0x91, 0xad, 0x22, 0xb6, 0xc8, 0x7b, 0xcb, 0xd9, 0x97, 0x50, 0xcf, 0xc8, 0x11, 0x3d, 0x50,
0x01, 0xff, 0x0a, 0xb4, 0xdd, 0x50, 0x1b, 0xda, 0x2b, 0x0e, 0x9e, 0x40, 0x23, 0xa7, 0x27, 0xf4,
0x50, 0x45, 0x6c, 0xd3, 0x58, 0x1b, 0xa5, 0x93, 0x9b, 0xaa, 0x05, 0x17, 0x8e, 0x0d, 0x51, 0x78,
0x2d, 0x1d, 0x32, 0x74, 0x2f, 0x21, 0x22, 0x3f, 0x74, 0xed, 0x98, 0xe1, 0x8d, 0x91, 0xc2, 0x85,
0xcf, 0x65, 0xf5, 0xf1, 0x78, 0xfe, 0x37, 0x00, 0x00, 0xff, 0xff, 0xdb, 0xb0, 0xef, 0x13, 0x5d,
0x06, 0x00, 0x00,
}
......@@ -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;
}
......@@ -16,6 +16,7 @@ import (
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)
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
}
......@@ -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,
}
......@@ -112,6 +114,7 @@ func masterReadyRoutine(db *mgdb.MongoManager, rooms *common.WaitingGroupMap, co
rooms.Broadcast(roomID, &readySignal{
ready: true,
data: bson.NewObjectId().Hex(),
documentHash: contract.File.Hash,
chain: contract.GetHashChain(),
sequence: GenerateSignSequence(len(contract.Signers)),
})
......
......@@ -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