From 7dfa743dce780659bd2e71130d91d51e93b1f68e Mon Sep 17 00:00:00 2001 From: Rasmus Dahlberg Date: Fri, 29 Jan 2021 17:29:34 +0100 Subject: replaced x509 with namespace on the client-side --- client/get-entries/main.go | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'client/get-entries/main.go') diff --git a/client/get-entries/main.go b/client/get-entries/main.go index 511d53d..1500cd0 100644 --- a/client/get-entries/main.go +++ b/client/get-entries/main.go @@ -5,24 +5,26 @@ import ( "flag" "fmt" + "encoding/base64" "net/http" "github.com/golang/glog" "github.com/system-transparency/stfe" "github.com/system-transparency/stfe/client" + "github.com/system-transparency/stfe/descriptor" ) var ( operators = flag.String("operators", "../../descriptor/stfe.json", "path to json-encoded list of log operators") - logId = flag.String("log_id", "B9oCJk4XIOMXba8dBM5yUj+NLtqTE6xHwbvR9dYkHPM=", "base64-encoded log identifier") - start = flag.Uint64("start", 50, "inclusive start index to download") - end = flag.Uint64("end", 60, "inclusive stop index to download") + logId = flag.String("log_id", "AAEgFKl1V+J3ib3Aav86UgGD7GRRtcKIdDhgc0G4vVD/TGc=", "base64-encoded log identifier") + start = flag.Uint64("start", 132, "inclusive start index to download") + end = flag.Uint64("end", 137, "inclusive stop index to download") ) func main() { flag.Parse() - if client, err := client.NewClientFromPath(*logId, "", "", *operators, &http.Client{}, true); err != nil { + if client, err := client.NewClient(mustLoad(*operators, *logId), &http.Client{}, true, nil); err != nil { glog.Fatal(err) } else if items, err := getRange(client, *start, *end); err != nil { glog.Fatal(err) @@ -66,3 +68,19 @@ func printRange(items []*stfe.StItem) error { } return nil } + +func mustLoad(operators, logId string) *descriptor.Log { + ops, err := descriptor.LoadOperators(operators) + if err != nil { + glog.Fatalf("failed loading log operators: %v") + } + id, err := base64.StdEncoding.DecodeString(logId) + if err != nil { + glog.Fatalf("invalid base64 log id: %v", err) + } + log, err := descriptor.FindLog(ops, id) + if err != nil { + glog.Fatalf("unknown log id: %v", err) + } + return log +} -- cgit v1.2.3