-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regression in key conversion in 0.9.7 #463
Comments
This sounds like you are trying to sign using an invalid key, or we have an underlying bug in key validation. Do you have a key that can reproduce the issue? |
Here's a minimal reproduction using a PKCS8 encrypted key: https://github.com/EpicEric/rsa-regression-example As it shows, |
Thanks for the repo, I just looked into it, and the failure happens in the key conversion, and not in actual signature generation here: https://github.com/RustCrypto/SSH/blob/ssh-key/v0.6.7/ssh-key/src/signature.rs#L668 let data = rsa::pkcs1v15::SigningKey::<Sha512>::try_from(self)? I don't know yet if the key itself is invalid, or there is an issue in the conversion. |
I've generated a new key with the following command, and the conversion error persists: openssl genrsa -aes128 -passout pass:blabla 3072 |
What a labyring of traits..but I found the bug that was revealed by the validation: https://github.com/RustCrypto/SSH/blob/ssh-key/v0.6.7/ssh-key/src/private/rsa.rs#L201-L202 rsa::BigUint::try_from(&key.private.p)?,
rsa::BigUint::try_from(&key.private.p)?, This is passing the |
TL;DR Regression pertaining to 2edd479.
With the 0.9.7 release, this created breakage when converting from an
RsaKeypair
to aSigningKey
. More specifically, in the context ofssh_key::Signer::try_sign
, which has caused tests with a dependency onrsa = "0.9"
to fail inrussh
due to this call. I've tried refreshing the key used for tests, but it still results in an error due to this change.The only fix I found was to pin the dependency on
rsa
to version 0.9.6, as seen in Eugeny/russh#400.The text was updated successfully, but these errors were encountered: