Skip to content

ssh-key: preserve signed certificate bytes verbatim - #659

Merged
tarcieri merged 1 commit into
masterfrom
ssh-key/preserve-signed-certificate-bytes
Dec 4, 2026
Merged

tarcieri merged 1 commit into
masterfrom
ssh-key/preserve-signed-certificate-bytes

Conversation

@tarcieri

@tarcieri tarcieri commented Dec 4, 2026

Copy link
Copy Markdown
Member

SSH certificate decoding can normalize fields such as RSA mpints, however the CA signs their wire encoding. Re-encoding the parsed fields can reject a valid signature or accept an encoding the CA never signed.

Make ssh_encoding::Readers independently Cloneable. Save the decoder position before parsing the certificate and use the cloned to copy the signed bytes through the CA public key. Reuse those bytes for signature verification and serialization. Have the builder retain the exact buffer it passes to the signer.

Unfortunately this requires another breaking change to ssh-encoding even after I just cut another rc, but hopefully that's the last one before a final release.

See also: #651

SSH certificate decoding can normalize fields such as RSA `mpints`,
however the CA signs their wire encoding. Re-encoding the parsed fields
can reject a valid signature or accept an encoding the CA never signed.

Make `ssh_encoding::Reader`s independently `Clone`able. Save the decoder
position before parsing the certificate and use the cloned to copy the
signed bytes through the CA public key. Reuse those bytes for signature
verification and serialization. Have the builder retain the exact buffer
it passes to the signer.

Unfortunately this requires another breaking change to `ssh-encoding`
even after I *just* cut another `rc`, but hopefully that's the last one
before a final release.

See also: #651
@tarcieri
tarcieri merged commit c6c358b into master Dec 4, 2026
21 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.

1 participant