From e34ec5b2159ac2c7272c3abef1084ba6b763fc56 Mon Sep 17 00:00:00 2001 From: Rasmus Dahlberg Date: Thu, 5 Nov 2020 17:05:21 +0100 Subject: added error handling for public key parsing --- descriptor/descriptor.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'descriptor') diff --git a/descriptor/descriptor.go b/descriptor/descriptor.go index 267a401..1879cd8 100644 --- a/descriptor/descriptor.go +++ b/descriptor/descriptor.go @@ -53,10 +53,7 @@ func LoadOperators(path string) ([]Operator, error) { return ops, nil } -func (l *Log) Key() crypto.PublicKey { - k, err := x509.ParsePKIXPublicKey(l.PublicKey) - if err != nil { - panic("TODO: make a new function and parse public key there") - } - return k +// Key parses the log's public key +func (l *Log) Key() (crypto.PublicKey, error) { + return x509.ParsePKIXPublicKey(l.PublicKey) } -- cgit v1.2.3