diff options
author | Rasmus Dahlberg <rasmus@mullvad.net> | 2022-04-13 16:10:43 +0200 |
---|---|---|
committer | Rasmus Dahlberg <rasmus@mullvad.net> | 2022-04-13 16:10:43 +0200 |
commit | 8fee6561fbc21bd44f67dff9f365aa14da293d99 (patch) | |
tree | e1f27b545439a7cb47254342cfbff6121bf41f6b /cmd/sigsum-debug/sign | |
parent | 8a4f764a7304ecbff07d451a21926bdc1a7fb3d4 (diff) |
clean-up sigsum-debug structure
Diffstat (limited to 'cmd/sigsum-debug/sign')
-rw-r--r-- | cmd/sigsum-debug/sign/sign.go | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/cmd/sigsum-debug/sign/sign.go b/cmd/sigsum-debug/sign/sign.go new file mode 100644 index 0000000..ac21472 --- /dev/null +++ b/cmd/sigsum-debug/sign/sign.go @@ -0,0 +1,31 @@ +package sign + +import ( + "fmt" + + "git.sigsum.org/sigsum-go/pkg/hex" + "git.sigsum.org/sigsum-go/pkg/types" + "git.sigsum.org/sigsum-tools-go/internal/util" +) + +func Main(_ []string, optPriv string, optShardHint uint64) error { + data, err := util.BytesFromStdin() + if err != nil { + return fmt.Errorf("sign: %v", err) + } + priv, err := util.SignerFromHex(optPriv) + if err != nil { + return fmt.Errorf("sign: %v", err) + } + stm := types.Statement{ + ShardHint: optShardHint, + Checksum: *types.HashFn(data), + } + sig, err := stm.Sign(priv) + if err != nil { + fmt.Errorf("sign: %v", err) + } + + fmt.Printf("%s\n", hex.Serialize(sig[:])) + return nil +} |