aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--registry/registry.go10
1 files changed, 3 insertions, 7 deletions
diff --git a/registry/registry.go b/registry/registry.go
index 83fe8e6..2833d57 100644
--- a/registry/registry.go
+++ b/registry/registry.go
@@ -3,7 +3,6 @@ package registry
import (
"bytes"
"context"
- "crypto/rsa"
"crypto/x509"
"encoding/gob"
"encoding/json"
@@ -208,21 +207,18 @@ func (r *Registry) Inbox(name string, req *http.Request) error {
pubKey := iter.Get()
pemProp := pubKey.GetW3IDSecurityV1PublicKeyPem()
pemStr := pemProp.Get()
+ pemStr = strings.ReplaceAll(pemStr, `\n`, "")
logger.With("keyId", keyId).With("pem", pemStr).Debugf("extracted pem")
pemObj, _ := pem.Decode([]byte(pemStr))
if pemObj == nil {
return fmt.Errorf("no PEM block found")
}
- decodedKey, err := x509.ParsePKIXPublicKey(pemObj.Bytes)
+ decodedKey, err := x509.ParsePKCS1PublicKey(pemObj.Bytes)
if err != nil {
return err
}
- rsaPub, ok := decodedKey.(*rsa.PublicKey)
- if !ok {
- return fmt.Errorf("not an RSA public key")
- }
algo := httpsig.RSA_SHA256
- return verifier.Verify(rsaPub, algo)
+ return verifier.Verify(decodedKey, algo)
}
func (r *Registry) ActivityOrNote(activityOrNote, name, id string) (map[string]interface{}, error) {