diff options
author | Linus Nordberg <linus@nordberg.se> | 2022-03-25 16:36:27 +0100 |
---|---|---|
committer | Rasmus Dahlberg <rasmus@mullvad.net> | 2022-03-28 19:10:49 +0200 |
commit | 8634892aa6d5d59f73e50652dbe750df263853a3 (patch) | |
tree | b979039d1c63107969f21ef5ce20dc9e827f2ab4 /pkg/types/leaf_test.go | |
parent | ace5e7c406dee2ca533d41f5271de0be7403a139 (diff) |
sign tree heads and leaves with SSHSIG
Diffstat (limited to 'pkg/types/leaf_test.go')
-rw-r--r-- | pkg/types/leaf_test.go | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/pkg/types/leaf_test.go b/pkg/types/leaf_test.go index 00e8256..645f49e 100644 --- a/pkg/types/leaf_test.go +++ b/pkg/types/leaf_test.go @@ -223,14 +223,17 @@ func TestLeavesFromASCII(t *testing.T) { func validStatement(t *testing.T) *Statement { return &Statement{ ShardHint: 72623859790382856, - Checksum: *newHashBufferInc(t), + Checksum: *HashFn(newHashBufferInc(t)[:]), } } func validStatementBytes(t *testing.T) []byte { return bytes.Join([][]byte{ - []byte{0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}, - newHashBufferInc(t)[:], + []byte("SSHSIG"), + []byte{0, 0, 0, 41}, []byte("tree_leaf:v0:72623859790382856@sigsum.org"), + []byte{0, 0, 0, 0}, + []byte{0, 0, 0, 6}, []byte("sha256"), + []byte{0, 0, 0, 32}, HashFn(newHashBufferInc(t)[:])[:], }, nil) } @@ -238,7 +241,7 @@ func validLeaf(t *testing.T) *Leaf { return &Leaf{ Statement: Statement{ ShardHint: 72623859790382856, - Checksum: *newHashBufferInc(t), + Checksum: *HashFn(newHashBufferInc(t)[:]), }, Signature: *newSigBufferInc(t), KeyHash: *newHashBufferInc(t), @@ -248,7 +251,7 @@ func validLeaf(t *testing.T) *Leaf { func validLeafBytes(t *testing.T) []byte { return bytes.Join([][]byte{ []byte{0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}, - newHashBufferInc(t)[:], + HashFn(newHashBufferInc(t)[:])[:], newSigBufferInc(t)[:], newHashBufferInc(t)[:], }, nil) @@ -257,7 +260,7 @@ func validLeafBytes(t *testing.T) []byte { func validLeafASCII(t *testing.T) string { return fmt.Sprintf("%s=%d\n%s=%x\n%s=%x\n%s=%x\n", "shard_hint", 72623859790382856, - "checksum", newHashBufferInc(t)[:], + "checksum", HashFn(newHashBufferInc(t)[:])[:], "signature", newSigBufferInc(t)[:], "key_hash", newHashBufferInc(t)[:], ) |