diff options
author | Rasmus Dahlberg <rasmus@mullvad.net> | 2022-04-29 23:00:26 +0200 |
---|---|---|
committer | Rasmus Dahlberg <rasmus@mullvad.net> | 2022-04-29 23:00:26 +0200 |
commit | 7661965ed955bc3b8fcbc544a346020e15678c02 (patch) | |
tree | d382464d2775d5417659daaeeb56c839cb91a676 /cmd/tmp/submit | |
parent | 203e2144f67269e879716e6406bb78e8e3728938 (diff) |
remove programs that sigsum-debug replaced
Diffstat (limited to 'cmd/tmp/submit')
-rw-r--r-- | cmd/tmp/submit/main.go | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/cmd/tmp/submit/main.go b/cmd/tmp/submit/main.go deleted file mode 100644 index 5699945..0000000 --- a/cmd/tmp/submit/main.go +++ /dev/null @@ -1,70 +0,0 @@ -package main - -// go run . | bash - -import ( - "crypto/ed25519" - "crypto/rand" - "encoding/hex" - "flag" - "fmt" - "log" - - "git.sigsum.org/sigsum-go/pkg/types" -) - -var ( - shardHint = flag.Uint64("shard_hint", 0, "shard hint (decimal)") - message = flag.String("message", "", "message (hex)") - sk = flag.String("sk", "", "secret key (hex)") - domainHint = flag.String("domain_hint", "example.com", "domain hint (string)") - base_url = flag.String("base_url", "localhost:6965/testonly", "base url (string)") -) - -func main() { - flag.Parse() - - var privBuf [64]byte - var priv ed25519.PrivateKey = ed25519.PrivateKey(privBuf[:]) - mustDecodeHex(*sk, priv[:]) - - var p types.Hash - if *message != "" { - mustDecodeHex(*message, p[:]) - } else { - mustPutRandom(p[:]) - } - - msg := types.Statement{ - ShardHint: *shardHint, - Checksum: *types.HashFn(p[:]), - } - sig := ed25519.Sign(priv, msg.ToBinary()) - - fmt.Printf("echo \"shard_hint=%d\nmessage=%x\nsignature=%x\npublic_key=%x\ndomain_hint=%s\" | curl --data-binary @- %s/sigsum/v0/add-leaf\n", - *shardHint, - p[:], - sig, - priv.Public().(ed25519.PublicKey)[:], - *domainHint, - *base_url, - ) -} - -func mustDecodeHex(s string, buf []byte) { - b, err := hex.DecodeString(s) - if err != nil { - log.Fatal(err) - } - if len(b) != len(buf) { - log.Fatal("bad flag: invalid buffer length") - } - copy(buf, b) -} - -func mustPutRandom(buf []byte) { - _, err := rand.Read(buf) - if err != nil { - log.Fatal(err) - } -} |