From 76b67507b902cebe701bd2e2b59beb455f96c923 Mon Sep 17 00:00:00 2001 From: Rasmus Dahlberg Date: Sun, 27 Mar 2022 20:38:05 +0200 Subject: add hashleaf and sign commands --- cmd/sigsum-debug/main.go | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'cmd/sigsum-debug/main.go') diff --git a/cmd/sigsum-debug/main.go b/cmd/sigsum-debug/main.go index 1d9e769..8b49e0b 100644 --- a/cmd/sigsum-debug/main.go +++ b/cmd/sigsum-debug/main.go @@ -31,9 +31,27 @@ Usage: sigsum-debug hashkey Reads a public key from stdin and output its key hash. + + sigsum-debug hashleaf -k PRIVATE_KEY [-s SHARD_HINT] + Reads data from STDIN and outputs a leaf hash. + -k, --private-key Private key to sign with + -s, --shard-hint Shard hint to use (Default: 0) + + sigsum-debug sign -k PRIVATE_KEY [-s SHARD_HINT] + Reads data from STDIN and outputs a signature. + -k, --private-key Private key to sign with + -s, --shard-hint Shard hint to use (Default: 0) + + sigsum-debug cosign -w WIT_PRIV -l LOG_PUB + Reads an ASCII signed tree head from STDIN and outputs a cosignature. + -w, --witness-priv Witness private key to sign with + -l, --log-pub Log public key to verify signed tree head ` var ( + optPriv, optPub string + optShardHint uint64 + someVersion = "unknown" ) @@ -50,6 +68,12 @@ func main() { err = CmdPubKey() case "hashkey": err = CmdHashKey() + case "hashleaf": + err = CmdHashLeaf(optPriv, optShardHint) + case "sign": + err = CmdSign(optPriv, optShardHint) + case "cosign": + err = fmt.Errorf("TODO") default: err = fmt.Errorf("invalid command %q, try %q", cmd.Name(), "sigsum help") } @@ -78,6 +102,15 @@ func parseCommand() *flag.FlagSet { func registerOptions(fs *flag.FlagSet) { switch cmd := fs.Name(); cmd { default: + case "hashleaf": + registerStringOption(fs, &optPriv, "k", "key", "") + registerUint64Option(fs, &optShardHint, "s", "shard-hint", 0) + case "sign": + registerStringOption(fs, &optPriv, "k", "key", "") + registerUint64Option(fs, &optShardHint, "s", "shard-hint", 0) + case "cosign": + registerStringOption(fs, &optPriv, "w", "--witness-priv", "") + registerStringOption(fs, &optPub, "l", "--log-pub", "") } } -- cgit v1.2.3