aboutsummaryrefslogtreecommitdiff
path: root/client/get-sth
diff options
context:
space:
mode:
authorRasmus Dahlberg <rasmus.dahlberg@kau.se>2020-11-03 12:14:51 +0100
committerRasmus Dahlberg <rasmus.dahlberg@kau.se>2020-11-03 12:14:51 +0100
commit4bef11c59c3e28f0f587b710d56d98c0f26591ad (patch)
treefeabd35c4f5d94df62117d0fb19df756a0f9011d /client/get-sth
parent6d3eb5bd4c9f5f3ec4cfdcf18e48ab86a6c247bf (diff)
added get-sth client without signature verification
Diffstat (limited to 'client/get-sth')
-rw-r--r--client/get-sth/main.go39
1 files changed, 39 insertions, 0 deletions
diff --git a/client/get-sth/main.go b/client/get-sth/main.go
new file mode 100644
index 0000000..6f0075b
--- /dev/null
+++ b/client/get-sth/main.go
@@ -0,0 +1,39 @@
+package main
+
+import (
+ "context"
+ "flag"
+ "fmt"
+
+ "net/http"
+
+ "github.com/golang/glog"
+ "github.com/system-transparency/stfe/client"
+)
+
+var (
+ operators = flag.String("operators", "../../server/descriptor/stfe.json", "path to json-encoded list of log operators")
+ logId = flag.String("log_id", "B9oCJk4XIOMXba8dBM5yUj+NLtqTE6xHwbvR9dYkHPM=", "base64-encoded log identifier")
+ chain = flag.String("chain", "../../server/testdata/chain/ee.pem", "path to pem-encoded certificate chain that the log accepts")
+)
+
+func main() {
+ flag.Parse()
+
+ client, err := client.NewClientFromPath(*logId, *chain, "", *operators, &http.Client{}, true)
+ if err != nil {
+ glog.Fatal(err)
+ }
+ sth, err := client.GetSth(context.Background())
+ if err != nil {
+ glog.Fatalf("get-sth failed: %v", err)
+ }
+
+ str, err := sth.MarshalB64()
+ if err != nil {
+ glog.Fatalf("failed encoding valid signed tree head: %v", err)
+ }
+ fmt.Println(str)
+
+ glog.Flush()
+}