sign/{ed25519,ed448}: check if public key is identity.#617
Open
cjpatton wants to merge 1 commit into
Open
Conversation
When parsing a public key or verifying a signature, check that the public key is not the identity element.
Member
|
What's the reasoning here? We can't check for all ways a public key can be weak. |
drmikecrypto
approved these changes
Jun 28, 2026
drmikecrypto
left a comment
There was a problem hiding this comment.
Nice catch — accepting the identity point as a valid public key would undermine signature verification assumptions.
The IsIdentity() check in verify() is the right layer (after FromBytes succeeds but before scalar math). The test vectors covering Verify, VerifyPh, VerifyWithCtx, and UnmarshalBinaryPublicKey look thorough.
One minor note: worth confirming IsIdentity() matches RFC 8032's encoding of the identity (y=1, x=0) for all code paths that ingest public keys, not just verify — but the unmarshal test already covers the scheme entry point.
LGTM from a security perspective.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When parsing a public key or verifying a signature, check that the public key is not the identity element.