Skip to content

Add signature size verification#4712

Merged
nikhil-gupta-tw merged 1 commit intofix/public-key-verify-messagefrom
fix/sig-verify
Mar 26, 2026
Merged

Add signature size verification#4712
nikhil-gupta-tw merged 1 commit intofix/public-key-verify-messagefrom
fix/sig-verify

Conversation

@nikhil-gupta-tw
Copy link
Copy Markdown

This pull request adds stricter validation for DER-encoded ECDSA signature sizes in the PublicKey::verifyAsDER method, ensuring that only signatures within the valid size range are accepted. It also introduces corresponding constants and new unit tests to verify this behavior.

Signature size validation improvements:

  • Added derSignatureMinSize and derSignatureMaxSize constants to PublicKey to define the valid size range for DER-encoded ECDSA signatures.
  • Updated PublicKey::verifyAsDER to reject signatures whose sizes are outside the valid DER range by returning false early.

Testing enhancements:

  • Added a new unit test VerifyAsDERRejectsInvalidSignatureSize to confirm that signatures with invalid sizes are correctly rejected by verifyAsDER.

@nikhil-gupta-tw nikhil-gupta-tw requested a review from a team as a code owner March 26, 2026 10:42
@nikhil-gupta-tw nikhil-gupta-tw merged commit ef9f377 into fix/public-key-verify-message Mar 26, 2026
@nikhil-gupta-tw nikhil-gupta-tw deleted the fix/sig-verify branch March 26, 2026 10:46
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