diff options
author | Linus Nordberg <linus@nordberg.se> | 2022-03-23 09:12:26 +0100 |
---|---|---|
committer | Linus Nordberg <linus@nordberg.se> | 2022-03-23 09:12:26 +0100 |
commit | f7d2c65559a5149e4923554695a99540abdcc56f (patch) | |
tree | 28a4c17471844b193938b83fe6e0b66a9d86f064 | |
parent | 8da382069f42f6d88d3abf914dd38d7e40a845bc (diff) |
follow SSHSIG changes in lib
-rw-r--r-- | cmd/sigsum/cmd.go | 19 | ||||
-rw-r--r-- | pkg/client/submitter.go | 4 |
2 files changed, 13 insertions, 10 deletions
diff --git a/cmd/sigsum/cmd.go b/cmd/sigsum/cmd.go index 70a1c51..417e68d 100644 --- a/cmd/sigsum/cmd.go +++ b/cmd/sigsum/cmd.go @@ -66,15 +66,18 @@ func cmdBundle(args []string, policy policy.Policy, optBundleType, optBundleKey, } req := requests.Leaf{ - Statement: types.Statement{ - ShardHint: policy.ShardHint(), - Checksum: *checksum, - }, + ShardHint: policy.ShardHint(), + Preimage: *checksum, Signature: *sig, VerificationKey: *pub, DomainHint: optBundleDomainHint, } - if !req.Statement.Verify(&req.VerificationKey, &req.Signature) { + + sd := types.SignedData{ + ShardHint: req.ShardHint, + Checksum: *types.HashFn(req.Preimage[:]), + } + if !sd.Verify(&req.VerificationKey, &req.Signature) { return fmt.Errorf("bundle: invalid signature for file %q", path) } reqs = append(reqs, req) @@ -103,12 +106,12 @@ func cmdFormat(args []string, policy policy.Policy) error { if err != nil { return fmt.Errorf("format: %v", err) } - stm := types.Statement{ + sd := types.SignedData{ ShardHint: policy.ShardHint(), - Checksum: *checksum, + Checksum: *types.HashFn(checksum[:]), } - fmt.Printf("%s", stm.ToBinary()) + fmt.Printf("%s", sd.ToBinary()) return nil } diff --git a/pkg/client/submitter.go b/pkg/client/submitter.go index f03e66a..21c9258 100644 --- a/pkg/client/submitter.go +++ b/pkg/client/submitter.go @@ -73,9 +73,9 @@ func (sc *SubmitClient) AddLeaves(_ context.Context, leaves []requests.Leaf) ([] bundles = nil for _, leaf := range leaves { l := types.Leaf{ - Statement: types.Statement{ + SignedData: types.SignedData{ ShardHint: leaf.ShardHint, - Checksum: leaf.Checksum, + Checksum: *types.HashFn(leaf.Preimage[:]), }, Signature: leaf.Signature, KeyHash: *types.HashFn(leaf.VerificationKey[:]), |