aboutsummaryrefslogtreecommitdiff
path: root/descriptor/descriptor.go
diff options
context:
space:
mode:
authorRasmus Dahlberg <rasmus.dahlberg@kau.se>2020-11-05 17:05:21 +0100
committerRasmus Dahlberg <rasmus.dahlberg@kau.se>2020-11-05 17:05:21 +0100
commite34ec5b2159ac2c7272c3abef1084ba6b763fc56 (patch)
treea79f6849613392fb169af628f2be45552af9e799 /descriptor/descriptor.go
parent36743a05a39f449628b153f1051bd854cf4ed6aa (diff)
added error handling for public key parsing
Diffstat (limited to 'descriptor/descriptor.go')
-rw-r--r--descriptor/descriptor.go9
1 files changed, 3 insertions, 6 deletions
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)
}