From 582fc381cae5464fe335ecab8a38635cc9afd47a Mon Sep 17 00:00:00 2001 From: Thomas Maurice Date: Mon, 12 Feb 2024 17:30:13 +0100 Subject: [PATCH] fix(crypto): marshal the keys in the right format --- pkg/crypto/key.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/crypto/key.go b/pkg/crypto/key.go index 2d2f360..ce2a8f1 100644 --- a/pkg/crypto/key.go +++ b/pkg/crypto/key.go @@ -27,5 +27,10 @@ func GenerateKeyPair(bytes int) (string, string, error) { privateKeyPEM := pem.EncodeToMemory(&privBlock) - return string(privateKeyPEM), string(base64.StdEncoding.EncodeToString(x509.MarshalPKCS1PublicKey(&privateKey.PublicKey))), nil + pubBytes, err := x509.MarshalPKIXPublicKey(&privateKey.PublicKey) + if err != nil { + return "", "", err + } + + return string(privateKeyPEM), string(base64.StdEncoding.EncodeToString(pubBytes)), nil }