aboutsummaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/add-entry/main.go14
-rw-r--r--client/client.go4
2 files changed, 5 insertions, 13 deletions
diff --git a/client/add-entry/main.go b/client/add-entry/main.go
index 693aca8..e782b09 100644
--- a/client/add-entry/main.go
+++ b/client/add-entry/main.go
@@ -89,17 +89,9 @@ func setup() (*client.Client, error) {
return nil, fmt.Errorf("failed decoding log identifier: %v", err)
}
- // TODO: define FindLog() for []Operator
- var log *descriptor.Log
- for _, op := range ops {
- l, err := op.FindLog(id)
- if err == nil {
- log = l
- break
- }
- }
- if log == nil {
- return nil, fmt.Errorf("unknown log identifier: %v", err)
+ log, err := descriptor.FindLog(ops, id)
+ if err != nil {
+ return nil, err
}
return client.NewClient(log, &http.Client{}, c, &k), nil
}
diff --git a/client/client.go b/client/client.go
index e1663a0..bf854b9 100644
--- a/client/client.go
+++ b/client/client.go
@@ -50,7 +50,7 @@ func (c *Client) AddEntry(ctx context.Context, name, checksum []byte) (*stfe.StI
}{
Item: base64.StdEncoding.EncodeToString(leaf),
Scheme: uint16(tls.Ed25519),
- Signature: base64.StdEncoding.EncodeToString(ed25519.Sign(*c.PrivateKey, serialized)),
+ Signature: base64.StdEncoding.EncodeToString(ed25519.Sign(*c.PrivateKey, leaf)),
Chain: c.b64Chain(),
})
if err != nil {
@@ -79,7 +79,7 @@ func (c *Client) AddEntry(ctx context.Context, name, checksum []byte) (*stfe.StI
if item.Format != stfe.StFormatSignedDebugInfoV1 {
return nil, fmt.Errorf("bad StItem format: %v", item.Format)
}
- if err := item.SignedDebugInfoV1.Verify(c.Log.Scheme, c.Log.PublicKey, serialized); err != nil {
+ if err := item.SignedDebugInfoV1.Verify(c.Log.Scheme, c.Log.PublicKey, leaf); err != nil {
return nil, fmt.Errorf("bad SignedDebugInfoV1 signature: %v", err)
}
return &item, nil