From 0b923b69c21107e6c619558fc01fa7d29f7e8c28 Mon Sep 17 00:00:00 2001 From: Dima Krasner Date: Sun, 28 Apr 2024 22:37:02 +0300 Subject: [PATCH] fall back to PKCS1 if public key decoding fails --- fed/verify.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fed/verify.go b/fed/verify.go index dd9e6b4d..c92b1e3b 100644 --- a/fed/verify.go +++ b/fed/verify.go @@ -44,7 +44,10 @@ func verify(ctx context.Context, domain string, cfg *cfg.Config, log *slog.Logge publicKey, err := x509.ParsePKIXPublicKey(publicKeyPem.Bytes) if err != nil { - return nil, fmt.Errorf("failed to verify message using %s: %w", sig.KeyID, err) + publicKey, err = x509.ParsePKCS1PublicKey(publicKeyPem.Bytes) + if err != nil { + return nil, fmt.Errorf("failed to verify message using %s: %w", sig.KeyID, err) + } } if err := sig.Verify(publicKey); err != nil {