diff options
author | Julio Capote <jcapote@gmail.com> | 2023-01-04 14:44:27 +0000 |
---|---|---|
committer | Julio Capote <jcapote@gmail.com> | 2023-01-04 14:44:27 +0000 |
commit | 5c92e0dd32f6e5d528a0daf5018f8493ceac75e7 (patch) | |
tree | 4544d84cb7fd879418c96db7d1c6f6cbcfdf9274 /registry/registry.go | |
parent | 55b5ea190b2cc7a355fb4fe939f296b8970374e0 (diff) | |
download | communique-5c92e0dd32f6e5d528a0daf5018f8493ceac75e7.tar.gz |
decode pem key first
Diffstat (limited to 'registry/registry.go')
-rw-r--r-- | registry/registry.go | 7 |
1 files changed, 4 insertions, 3 deletions
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 } |