aboutsummaryrefslogtreecommitdiff
path: root/cmd/tmp
diff options
context:
space:
mode:
authorRasmus Dahlberg <rasmus@mullvad.net>2022-04-29 23:00:26 +0200
committerRasmus Dahlberg <rasmus@mullvad.net>2022-04-29 23:00:26 +0200
commit7661965ed955bc3b8fcbc544a346020e15678c02 (patch)
treed382464d2775d5417659daaeeb56c839cb91a676 /cmd/tmp
parent203e2144f67269e879716e6406bb78e8e3728938 (diff)
remove programs that sigsum-debug replaced
Diffstat (limited to 'cmd/tmp')
-rw-r--r--cmd/tmp/README.md2
-rw-r--r--cmd/tmp/cosign/main.go68
-rw-r--r--cmd/tmp/dns/main.go42
-rw-r--r--cmd/tmp/keygen/main.go20
-rw-r--r--cmd/tmp/submit/main.go70
5 files changed, 0 insertions, 202 deletions
diff --git a/cmd/tmp/README.md b/cmd/tmp/README.md
deleted file mode 100644
index 30d5317..0000000
--- a/cmd/tmp/README.md
+++ /dev/null
@@ -1,2 +0,0 @@
-# Warning
-These basic commands will be moved or replaced by proper tooling.
diff --git a/cmd/tmp/cosign/main.go b/cmd/tmp/cosign/main.go
deleted file mode 100644
index 5d07368..0000000
--- a/cmd/tmp/cosign/main.go
+++ /dev/null
@@ -1,68 +0,0 @@
-package main
-
-import (
- "bytes"
- "crypto/ed25519"
- "flag"
- "fmt"
- "log"
- "net/http"
-
- "git.sigsum.org/sigsum-go/pkg/hex"
- "git.sigsum.org/sigsum-go/pkg/requests"
- "git.sigsum.org/sigsum-go/pkg/types"
-)
-
-var (
- url = flag.String("url", "http://localhost:6965/testonly/sigsum/v0", "base url")
- sk = flag.String("sk", "e1d7c494dacb0ddf809a17e4528b01f584af22e3766fa740ec52a1711c59500d711090dd2286040b50961b0fe09f58aa665ccee5cb7ee042d819f18f6ab5046b", "witness secret key (hex)")
- log_vk = flag.String("log_vk", "cc0e7294a9d002c33aaa828efba6622ab1ce8ebdb8a795902555c2813133cfe8", "log public key (hex)")
-)
-
-func main() {
- flag.Parse()
-
- log_vk, err := hex.Deserialize(*log_vk)
- if err != nil {
- log.Fatalf("Deserialize: %v", err)
- }
-
- priv, err := hex.Deserialize(*sk)
- if err != nil {
- log.Fatal(err)
- }
- sk := ed25519.PrivateKey(priv)
- vk := sk.Public().(ed25519.PublicKey)
- fmt.Printf("sk: %x\nvk: %x\n", sk, vk)
-
- rsp, err := http.Get(*url + "/get-tree-head-to-cosign")
- if err != nil {
- log.Fatal(err)
- }
- var sth types.SignedTreeHead
- if err := sth.FromASCII(rsp.Body); err != nil {
- log.Fatal(err)
- }
- fmt.Printf("%+v\n\n", sth)
-
- namespace := types.HashFn(log_vk)
- witSTH, err := sth.TreeHead.Sign(sk, namespace)
- if err != nil {
- log.Fatal(err)
- }
-
- req := requests.Cosignature{
- KeyHash: *types.HashFn(vk[:]),
- Cosignature: witSTH.Signature,
- }
- buf := bytes.NewBuffer(nil)
- if err := req.ToASCII(buf); err != nil {
- log.Fatal(err)
- }
-
- rsp, err = http.Post(*url+"/add-cosignature", "type/sigsum", buf)
- if err != nil {
- log.Fatal(err)
- }
- fmt.Printf("Status: %v\n", rsp.StatusCode)
-}
diff --git a/cmd/tmp/dns/main.go b/cmd/tmp/dns/main.go
deleted file mode 100644
index ea0a4e5..0000000
--- a/cmd/tmp/dns/main.go
+++ /dev/null
@@ -1,42 +0,0 @@
-package main
-
-import (
- "context"
- "flag"
- "fmt"
- "log"
-
- "git.sigsum.org/sigsum-go/pkg/hex"
- "git.sigsum.org/sigsum-go/pkg/types"
- "git.sigsum.org/log-go/pkg/dns"
-)
-
-var (
- vk = flag.String("vk", "5aed7ffc3bc088221f6579567b2e6e3c4ac3579bd5e77670755179052c68d5d3", "public key (hex)")
- domain_hint = flag.String("domain_hint", "example.com", "domain name that is aware of public key hash in hex")
-)
-
-func main() {
- flag.Parse()
-
- var key types.PublicKey
- mustDecodeHex(*vk, key[:])
-
- vf := dns.NewDefaultResolver()
- if err := vf.Verify(context.Background(), *domain_hint, &key); err != nil {
- log.Fatal(err)
- }
-
- fmt.Println("Success!")
-}
-
-func mustDecodeHex(s string, buf []byte) {
- b, err := hex.Deserialize(s)
- if err != nil {
- log.Fatal(err)
- }
- if len(b) != len(buf) {
- log.Fatal("bad flag: invalid buffer length")
- }
- copy(buf, b)
-}
diff --git a/cmd/tmp/keygen/main.go b/cmd/tmp/keygen/main.go
deleted file mode 100644
index b692f7f..0000000
--- a/cmd/tmp/keygen/main.go
+++ /dev/null
@@ -1,20 +0,0 @@
-package main
-
-import (
- "crypto/ed25519"
- "crypto/rand"
- "fmt"
- "log"
-
- "git.sigsum.org/sigsum-go/pkg/types"
-)
-
-func main() {
- vk, sk, err := ed25519.GenerateKey(rand.Reader)
- if err != nil {
- log.Fatalf("GenerateKey: %v", err)
- }
- fmt.Printf("sk: %x\n", sk[:])
- fmt.Printf("vk: %x\n", vk[:])
- fmt.Printf("kh: %x\n", types.HashFn(vk[:])[:])
-}
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)
- }
-}