aboutsummaryrefslogtreecommitdiff
path: root/cmd/sigsum-debug/main.go
diff options
context:
space:
mode:
authorRasmus Dahlberg <rasmus@mullvad.net>2022-04-23 18:44:09 +0200
committerRasmus Dahlberg <rasmus@mullvad.net>2022-04-23 18:44:09 +0200
commitcc9bb6a069d62ed37b7f4866d6dfe37049dc1cf1 (patch)
tree3dc49efe0e0690656897dc8562da6b7cbc41c9ea /cmd/sigsum-debug/main.go
parent2c28b4209be2ced9a18c20347e1819a24a45cb66 (diff)
remove sigsum-debug (pending merge in sigsum-go)HEADmain
Diffstat (limited to 'cmd/sigsum-debug/main.go')
-rw-r--r--cmd/sigsum-debug/main.go114
1 files changed, 0 insertions, 114 deletions
diff --git a/cmd/sigsum-debug/main.go b/cmd/sigsum-debug/main.go
deleted file mode 100644
index fe13cfd..0000000
--- a/cmd/sigsum-debug/main.go
+++ /dev/null
@@ -1,114 +0,0 @@
-// package main provides a tool named sigsum-debug.
-//
-// Build as follows:
-//
-// $ go build -ldflags="-X 'main.someVersion=git commit $(git rev-list -1 HEAD)'"
-// $ mv sigsum-debug $GOPATH/bin/
-//
-// Usage:
-//
-// $ sigsum-debug help
-//
-package main
-
-import (
- "flag"
- "fmt"
- "log"
- "os"
-
- "git.sigsum.org/sigsum-tools-go/cmd/sigsum-debug/cosign"
- "git.sigsum.org/sigsum-tools-go/cmd/sigsum-debug/genkey"
- "git.sigsum.org/sigsum-tools-go/cmd/sigsum-debug/hashkey"
- "git.sigsum.org/sigsum-tools-go/cmd/sigsum-debug/hashleaf"
- "git.sigsum.org/sigsum-tools-go/cmd/sigsum-debug/pubkey"
- "git.sigsum.org/sigsum-tools-go/cmd/sigsum-debug/sign"
- "git.sigsum.org/sigsum-tools-go/internal/options"
-)
-
-const usage = `sigsum-debug version %s
-
-Usage:
- sigsum-debug help
- Outputs a usage message.
-
- sigsum-debug genkey
- Outputs a new private key.
-
- sigsum-debug pubkey
- Reads a private key from stdin and output its public key.
-
- 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 string
- optPub string
- optShardHint uint64
-
- someVersion = "devel"
-)
-
-func main() {
- log.SetFlags(0)
-
- var err error
- cmd := options.Parse(printUsage, setOptions)
- switch cmd.Name() {
- case "help":
- cmd.Usage()
- case "genkey":
- err = genkey.Main(cmd.Args())
- case "pubkey":
- err = pubkey.Main(cmd.Args())
- case "hashkey":
- err = hashkey.Main(cmd.Args())
- case "hashleaf":
- err = hashleaf.Main(cmd.Args(), optPriv, optShardHint)
- case "sign":
- err = sign.Main(cmd.Args(), optPriv, optShardHint)
- case "cosign":
- err = cosign.Main(cmd.Args(), optPriv, optPub)
- default:
- err = fmt.Errorf("invalid command %q, try %q", cmd.Name(), "sigsum help")
- }
-
- if err != nil {
- log.Printf("%s", err)
- os.Exit(1)
- }
-}
-
-func printUsage() {
- log.Printf(usage, someVersion)
-}
-
-func setOptions(fs *flag.FlagSet) {
- switch cmd := fs.Name(); cmd {
- case "hashleaf":
- options.AddString(fs, &optPriv, "k", "key", "")
- options.AddUint64(fs, &optShardHint, "s", "shard-hint", 0)
- case "sign":
- options.AddString(fs, &optPriv, "k", "key", "")
- options.AddUint64(fs, &optShardHint, "s", "shard-hint", 0)
- case "cosign":
- options.AddString(fs, &optPriv, "w", "witness-priv", "")
- options.AddString(fs, &optPub, "l", "log-pub", "")
- }
-}