aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulio Capote <jcapote@gmail.com>2023-01-06 16:55:24 +0000
committerJulio Capote <jcapote@gmail.com>2023-01-06 16:55:24 +0000
commit6ef71d5d1c97a135b479effb4858a3e6e45edec1 (patch)
treefaec18f9a3d3b808f19ab84e039f6ef3fb91e43d
parent0462583c72892ae38993872f390ce4a6c2458cda (diff)
downloadcommunique-6ef71d5d1c97a135b479effb4858a3e6e45edec1.tar.gz
was the preamble wrong the whole time?
-rw-r--r--registry/registry.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/registry/registry.go b/registry/registry.go
index 290c2bd..6733c74 100644
--- a/registry/registry.go
+++ b/registry/registry.go
@@ -90,7 +90,7 @@ func (r *Registry) Actor(name string) (map[string]interface{}, error) {
privKey := &keypair.PrivateKey
pemdata := pem.EncodeToMemory(
&pem.Block{
- Type: "PUBLIC KEY",
+ Type: "RSA PUBLIC KEY",
Bytes: x509.MarshalPKCS1PublicKey(&privKey.PublicKey),
},
)
@@ -302,7 +302,8 @@ func (r *Registry) deliverAcceptToInbox(url, actorUrl, actorKeyUrl *url.URL, fol
return err
}
- // verify our own signature to ensure sanity
+ // sanity check: decode our own public key from our PEM representation and attempt to verify
+
err = rsa.VerifyPKCS1v15(&privKey.PublicKey, crypto.SHA256, digestBytes[:], signature)
if err != nil {
return err