Skip to content

fix(client): encode the negotiated hash algorithm for RSA certificates - #764

Merged
Eugeny merged 1 commit into
Eugeny:mainfrom
inureyes:fix/rsa-certificate-hash-alg
Sep 3, 2026
Merged

fix(client): encode the negotiated hash algorithm for RSA certificates#764
Eugeny merged 1 commit into
Eugeny:mainfrom
inureyes:fix/rsa-certificate-hash-alg

Conversation

@inureyes

@inureyes inureyes commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Method::FutureCertificate carries a hash_alg, but both the probe request and the signed request encoded cert.algorithm().to_certificate_type(), which always yields ssh-rsa-cert-v01@openssh.com for an RSA certificate. A server that rejects SHA-1 signatures therefore refuses RSA user certificates even when the client selected SHA-256 or SHA-512.

client_make_to_sign now takes the certificate hash algorithm and applies it with with_hash_alg in both places, so the wire carries rsa-sha2-512-cert-v01@openssh.com or rsa-sha2-256-cert-v01@openssh.com when one is selected. Non-RSA certificates encode identically to before, and the self-signed OpenSshCertificate path passes None, so its behavior is unchanged.

A new test drives all three hash selections through both the probe and the signed request. Removing either with_hash_alg call makes it fail with ssh-rsa-cert-v01@openssh.com.

compression::tests::partial_flush_packets_round_trip fails on main at d3ae702 as well, and #757 looks like the fix. Everything else passes.

`Method::FutureCertificate` carries a `hash_alg`, but both the probe request and the signed request encoded `cert.algorithm().to_certificate_type()`, which always yields `ssh-rsa-cert-v01@openssh.com` for an RSA certificate. Servers that reject SHA-1 signatures therefore refuse RSA user certificates even when the client selected SHA-256 or SHA-512.

Thread the hash algorithm into `client_make_to_sign` and apply it with `with_hash_alg` in both places, so the wire carries `rsa-sha2-512-cert-v01@openssh.com` or `rsa-sha2-256-cert-v01@openssh.com` when one is selected. Non-RSA certificates and the self-signed `OpenSshCertificate` path are unaffected.
@Eugeny

Eugeny commented Sep 3, 2026

Copy link
Copy Markdown
Owner

Thank you! @all-contributors add @inureyes for code

@allcontributors

Copy link
Copy Markdown
Contributor

@Eugeny

@inureyes already contributed before to code

@Eugeny
Eugeny merged commit 9e1068b into Eugeny:main Sep 3, 2026
9 of 11 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.

2 participants