From 5c92e0dd32f6e5d528a0daf5018f8493ceac75e7 Mon Sep 17 00:00:00 2001 From: Julio Capote Date: Wed, 4 Jan 2023 09:44:27 -0500 Subject: decode pem key first --- registry/registry.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'registry') diff --git a/registry/registry.go b/registry/registry.go index 7cdc5dd..25d4360 100644 --- a/registry/registry.go +++ b/registry/registry.go @@ -205,10 +205,11 @@ func (r *Registry) Inbox(name string, req *http.Request) error { iter := pubKeyProp.At(0) pubKey := iter.Get() pemProp := pubKey.GetW3IDSecurityV1PublicKeyPem() - pem := pemProp.Get() - logger.With("keyId", keyId).With("pem", pem).Debugf("extracted pem") + pemStr := pemProp.Get() + logger.With("keyId", keyId).With("pem", pemStr).Debugf("extracted pem") + pemObj, _ := pem.Decode([]byte(pemStr)) - decodedKey, err := x509.ParsePKCS1PublicKey([]byte(pem)) + decodedKey, err := x509.ParsePKCS1PublicKey(pemObj.Bytes) if err != nil { return err } -- cgit v1.2.3