From 8634892aa6d5d59f73e50652dbe750df263853a3 Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Fri, 25 Mar 2022 16:36:27 +0100 Subject: sign tree heads and leaves with SSHSIG --- pkg/types/leaf.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'pkg/types/leaf.go') diff --git a/pkg/types/leaf.go b/pkg/types/leaf.go index 1476ead..e7e81dd 100644 --- a/pkg/types/leaf.go +++ b/pkg/types/leaf.go @@ -24,9 +24,16 @@ type Leaf struct { type Leaves []Leaf func (s *Statement) ToBinary() []byte { - b := make([]byte, 40) - binary.BigEndian.PutUint64(b[0:8], s.ShardHint) - copy(b[8:40], s.Checksum[:]) + namespace := fmt.Sprintf("tree_leaf:v0:%d@sigsum.org", s.ShardHint) + b := make([]byte, 6+4+len(namespace)+4+0+4+6+4+HashSize) + + copy(b[0:6], "SSHSIG") + i := 6 + i += putSSHString(b[i:], namespace) + i += putSSHString(b[i:], "") + i += putSSHString(b[i:], "sha256") + i += putSSHString(b[i:], string(s.Checksum[:])) + return b } -- cgit v1.2.3