Skip to content

Commit

Permalink
fall back to PKCS1 if public key decoding fails
Browse files Browse the repository at this point in the history
  • Loading branch information
dimkr committed Apr 28, 2024
1 parent aa40e26 commit 0b923b6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fed/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 0b923b6

Please sign in to comment.