Skip to content

Conversation

@orentysor
Copy link
Contributor

When shouldHash=false, the message must be exactly 32 bytes (a hash). Messages longer than 32 bytes caused calculation errors (messages larger than the curve order when converted to bigint) or verification failures because secp256k1.recoverPublicKey() expects exactly 32 bytes.

Adds validation in sign() and verify() methods to enforce this requirement and adds tests to verify the fix.

Refs: HSM-129

@orentysor orentysor requested review from a team as code owners November 4, 2025 17:04
@orentysor orentysor changed the title fix(ecdsa): validate 32-byte message requirement when shouldHash=false fix: validate 32-byte message requirement when shouldHash=false Nov 4, 2025
@orentysor orentysor changed the title fix: validate 32-byte message requirement when shouldHash=false fix(sdk-core): validate 32-byte message requirement when shouldHash=false Nov 4, 2025
…en shouldHash=false

When shouldHash=false, the message must be exactly 32 bytes (a hash).
Messages longer than 32 bytes caused calculation errors (messages larger
than the curve order when converted to bigint) or verification failures
because secp256k1.recoverPublicKey() expects exactly 32 bytes.

Adds validation in sign() and verify() methods to enforce this requirement
and adds tests to verify the fix.

Refs: HSM-129

TICKET: HSM-129
@orentysor orentysor changed the title fix(sdk-core): validate 32-byte message requirement when shouldHash=false fix: validate 32-byte message requirement when shouldHash=false Nov 4, 2025
Copy link
Contributor

@zhongxishen zhongxishen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@orentysor orentysor merged commit 63650d6 into master Nov 4, 2025
13 checks passed
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.

3 participants