aboutsummaryrefslogtreecommitdiff
path: root/registry
diff options
context:
space:
mode:
authorJulio Capote <jcapote@gmail.com>2023-01-04 15:06:02 +0000
committerJulio Capote <jcapote@gmail.com>2023-01-04 15:06:02 +0000
commit66396ff79d72cfaa1aea89ad25a9648f08b2f0ea (patch)
tree2f4a5f38da73f943594ab797d07e43797353378f /registry
parent3e4234ca5ad53361c8d7384930a8e182add744b9 (diff)
downloadcommunique-66396ff79d72cfaa1aea89ad25a9648f08b2f0ea.tar.gz
replace newlines
Diffstat (limited to 'registry')
-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) {