Skip to content

fix(publisher): pad ECDSA P-384 signature to fixed width#1457

Open
JosephDoUrden wants to merge 1 commit into
modelcontextprotocol:mainfrom
JosephDoUrden:fix/ecdsa-p384-signature-padding
Open

fix(publisher): pad ECDSA P-384 signature to fixed width#1457
JosephDoUrden wants to merge 1 commit into
modelcontextprotocol:mainfrom
JosephDoUrden:fix/ecdsa-p384-signature-padding

Conversation

@JosephDoUrden

Copy link
Copy Markdown
Contributor

The in-process ECDSA P-384 signer built the signature with append(r.Bytes(), s.Bytes()...). big.Int.Bytes() strips leading zero bytes, so whenever r or s had a high zero byte (roughly 1 in 128 signatures) the concatenation came out shorter than 96 bytes and the registry rejected the publish with "invalid signature size for ECDSA P-384". Intermittent and confusing to debug. Fixed by left-padding each component to 48 bytes with FillBytes, same as the googlekms signer already does. Added a test pinning the fixed-width encoding plus a sign/verify round-trip.

r.Bytes() and s.Bytes() drop leading zero bytes, so the R || S
signature was occasionally shorter than 96 bytes and the registry
rejected it with "invalid signature size for ECDSA P-384". Left-pad
each component to 48 bytes with FillBytes, matching the googlekms signer.
@JosephDoUrden
JosephDoUrden force-pushed the fix/ecdsa-p384-signature-padding branch from a2271a0 to a10ebed Compare July 16, 2026 21:33
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.

1 participant