diff options
author | Rasmus Dahlberg <rasmus.dahlberg@kau.se> | 2020-11-05 17:05:21 +0100 |
---|---|---|
committer | Rasmus Dahlberg <rasmus.dahlberg@kau.se> | 2020-11-05 17:05:21 +0100 |
commit | e34ec5b2159ac2c7272c3abef1084ba6b763fc56 (patch) | |
tree | a79f6849613392fb169af628f2be45552af9e799 /client/client.go | |
parent | 36743a05a39f449628b153f1051bd854cf4ed6aa (diff) |
added error handling for public key parsing
Diffstat (limited to 'client/client.go')
-rw-r--r-- | client/client.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/client/client.go b/client/client.go index 88ccf2f..159a5df 100644 --- a/client/client.go +++ b/client/client.go @@ -104,7 +104,9 @@ func (c *Client) AddEntry(ctx context.Context, name, checksum []byte) (*stfe.StI return nil, fmt.Errorf("bad StItem format: %v", item.Format) } - if err := VerifySignedDebugInfoV1(item, c.Log.Scheme, c.Log.Key(), leaf); err != nil { + if k, err := c.Log.Key(); err != nil { + return nil, fmt.Errorf("bad public key: %v", err) + } else if err := VerifySignedDebugInfoV1(item, c.Log.Scheme, k, leaf); err != nil { return nil, fmt.Errorf("bad SignedDebugInfoV1 signature: %v", err) } return item, nil @@ -125,7 +127,9 @@ func (c *Client) GetSth(ctx context.Context) (*stfe.StItem, error) { return nil, fmt.Errorf("bad StItem format: %v", item.Format) } - if err := VerifySignedTreeHeadV1(item, c.Log.Scheme, c.Log.Key()); err != nil { + if k, err := c.Log.Key(); err != nil { + return nil, fmt.Errorf("bad public key: %v", err) + } else if err := VerifySignedTreeHeadV1(item, c.Log.Scheme, k); err != nil { return nil, fmt.Errorf("bad SignedDebugInfoV1 signature: %v", err) } return item, nil |