diff options
author | Rasmus Dahlberg <rasmus.dahlberg@kau.se> | 2021-06-01 00:24:07 +0200 |
---|---|---|
committer | Rasmus Dahlberg <rasmus.dahlberg@kau.se> | 2021-06-01 00:24:07 +0200 |
commit | 6aa7e4879ad72bfe5e344f6a55b22837fd6ce2bd (patch) | |
tree | 0f1f8998bb1ae7f9934e3fedfeb7c236902f7887 /client/cmd/submit/main.go | |
parent | 519784b5ee58370d6c1262b0eb6c72ee3580f293 (diff) |
added basic commands to interact with stfe server
Diffstat (limited to 'client/cmd/submit/main.go')
-rw-r--r-- | client/cmd/submit/main.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/client/cmd/submit/main.go b/client/cmd/submit/main.go new file mode 100644 index 0000000..36c7271 --- /dev/null +++ b/client/cmd/submit/main.go @@ -0,0 +1,28 @@ +package main + +// go run . | bash + +import ( + "crypto/ed25519" + "crypto/rand" + "fmt" + "github.com/system-transparency/stfe/types" +) + +func main() { + checksum := [32]byte{} + msg := types.Message{ + ShardHint: 0, + Checksum: &checksum, + } + + vk, sk, err := ed25519.GenerateKey(rand.Reader) + if err != nil { + fmt.Printf("ed25519.GenerateKey: %v\n", err) + return + } + sig := ed25519.Sign(sk, msg.Marshal()) + //fmt.Printf("sk: %x\nvk: %x\n", sk[:], vk[:]) + + fmt.Printf("echo \"shard_hint=%d\nchecksum=%x\nsignature_over_message=%x\nverification_key=%x\ndomain_hint=%s\" | curl --data-binary @- localhost:6965/st/v0/add-leaf\n", msg.ShardHint, msg.Checksum[:], sig, vk[:], "example.com") +} |