aboutsummaryrefslogtreecommitdiff
path: root/pkg/types/tree_head_test.go
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordberg.se>2022-03-25 16:36:27 +0100
committerRasmus Dahlberg <rasmus@mullvad.net>2022-03-28 19:10:49 +0200
commit8634892aa6d5d59f73e50652dbe750df263853a3 (patch)
treeb979039d1c63107969f21ef5ce20dc9e827f2ab4 /pkg/types/tree_head_test.go
parentace5e7c406dee2ca533d41f5271de0be7403a139 (diff)
sign tree heads and leaves with SSHSIG
Diffstat (limited to 'pkg/types/tree_head_test.go')
-rw-r--r--pkg/types/tree_head_test.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/pkg/types/tree_head_test.go b/pkg/types/tree_head_test.go
index 03a52f5..f20afe0 100644
--- a/pkg/types/tree_head_test.go
+++ b/pkg/types/tree_head_test.go
@@ -7,6 +7,8 @@ import (
"io"
"reflect"
"testing"
+
+ "git.sigsum.org/sigsum-lib-go/pkg/hex"
)
func TestTreeHeadToBinary(t *testing.T) {
@@ -186,11 +188,18 @@ func validTreeHead(t *testing.T) *TreeHead {
}
func validTreeHeadBytes(t *testing.T, keyHash *Hash) []byte {
- return bytes.Join([][]byte{
+ ns := fmt.Sprintf("tree_head:v0:%s@sigsum.org", hex.Serialize((*keyHash)[:]))
+ th := bytes.Join([][]byte{
[]byte{0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08},
[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01},
newHashBufferInc(t)[:],
- keyHash[:],
+ }, nil)
+ return bytes.Join([][]byte{
+ []byte("SSHSIG"),
+ []byte{0, 0, 0, 88}, []byte(ns),
+ []byte{0, 0, 0, 0},
+ []byte{0, 0, 0, 6}, []byte("sha256"),
+ []byte{0, 0, 0, 32}, (*HashFn(th))[:],
}, nil)
}