Skip to content

P256,P384,P512: reject incorrect ECDSA curve when reading keys#42

Merged
MichaelMure merged 1 commit into
masterfrom
reject-wrong-curve
Jun 23, 2026
Merged

P256,P384,P512: reject incorrect ECDSA curve when reading keys#42
MichaelMure merged 1 commit into
masterfrom
reject-wrong-curve

Conversation

@MichaelMure

@MichaelMure MichaelMure commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Note

Medium Risk
Tightens cryptographic key parsing in security-sensitive code; valid keys on the correct curve are unchanged, but previously accepted wrong-curve imports will now error.

Overview
P-256, P-384, and P-521 key loaders now reject keys on the wrong curve when importing X.509 DER public keys and PKCS#8 DER private keys. Each package checks ecdsaPub.Curve / ecdsaPriv.Curve against its expected elliptic curve and returns a clear error instead of accepting another NIST curve’s material.

Tests add TestRejectForeignCurveX509AndPKCS8 in each package, generating keys from sibling curves and asserting PublicKeyFromX509DER and PrivateKeyFromPKCS8DER fail.

Reviewed by Cursor Bugbot for commit 86d95b9. Bugbot is set up for automated code reviews on this repo. Configure here.

@MichaelMure MichaelMure merged commit 4d3805f into master Jun 23, 2026
7 checks passed
@MichaelMure MichaelMure deleted the reject-wrong-curve branch June 23, 2026 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants