SSH icon indicating copy to clipboard operation
SSH copied to clipboard

Introduce a crate feature to allow <1024 bit RSA keys

Open Eugeny opened this issue 11 months ago • 3 comments

There are still tons of legacy devices (in particular network switches) out there that use 1024bit RSA keys. The ssh-key crate should provide an escape hatch that lets the consumer make these security decisions themselves.

I'll make a PR shortly

Eugeny avatar Feb 24 '25 21:02 Eugeny

We're discussing enforcing a minimum modulus of 1024-bits in the rsa crate itself: https://github.com/RustCrypto/RSA/issues/445

tarcieri avatar Feb 28 '25 08:02 tarcieri

rsa itself having a feature for that would be a nicer solution I guess? ssh-key could then just forward it.

The only issue I see is that any crate in a workspace could "poison" the rsa create by enabling that feature for the entire workspace.

For my use case personally, I'd be fine with rsa just having a 1024 bit minimum hardcoded (that would be the same that OpenSSH already has)

Eugeny avatar Feb 28 '25 09:02 Eugeny

Yeah, I don't think it makes sense to remove the key size check entirely. 1024-bits should be the hard floor

tarcieri avatar Feb 28 '25 09:02 tarcieri

What's the current thought on the minimum here?

For Arti (the Rust implementation of Tor), we need support for 1024 bit RSA keys (they aren't used for any security purpose, they're legacy keys that exist for backwards compatibility). Would you be open to reducing the minimum to 1024 bits for now?

I'll make a PR for this, but if there's some alternative you'd prefer let me know and I could implement that as well.

WesleyAC avatar Sep 30 '25 18:09 WesleyAC

@tarcieri given that https://github.com/RustCrypto/RSA/pull/576 is merged, is it acceptable to remove this limit from ssh-key now, or will you want to wait for more to be done on https://github.com/RustCrypto/RSA/issues/445 first?

Just want to get an idea of what the timeline is like on this :)

WesleyAC avatar Sep 30 '25 18:09 WesleyAC

We ended up reverting that but the plan is to get a soft limit in place before the next release.

I guess we can go ahead and remove the limit here, even if that isn’t fully implemented yet

tarcieri avatar Sep 30 '25 18:09 tarcieri