fix(publisher): pad ECDSA P-384 signature to fixed width#1457
Open
JosephDoUrden wants to merge 1 commit into
Open
fix(publisher): pad ECDSA P-384 signature to fixed width#1457JosephDoUrden wants to merge 1 commit into
JosephDoUrden wants to merge 1 commit into
Conversation
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
force-pushed
the
fix/ecdsa-p384-signature-padding
branch
from
July 16, 2026 21:33
a2271a0 to
a10ebed
Compare
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.
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.