ssh-key: add a crate feature to allow insecure RSA keys - fixes #336
Ref https://github.com/Eugeny/russh/issues/468
It would probably make sense to figure out a common naming convention we can use for rsa and dsa which allows insecure cryptography
I'm fine with it either way. I've chosen the hazmat- prefix as it's used as module name for dangerous stuff elsewhere in RustCrypto (e.g. rsa). I can rename dsa to hazmat-dsa but I think the current name is better as it's in line with other algo features.
Related: https://github.com/RustCrypto/RSA/issues/445
Using crate features can be dangerous as features are unified, so if one crate enables it it disable this protection for another crate. I think this should be opt-in for each use-site, rather than globally.
Yeah, if we support this it would be better to have an explicit API for it (which could still be feature-gated)
We can probably remove this check entirely when the rsa crate enforces a minimum modulus size (RustCrypto/RSA#445), which is currently proposed to be 1024-bits.
@Eugeny would that be good enough for your use cases? I hope you don't actually want to use RSA keys smaller than that.
That would be perfectly fine and also aligns with what OpenSSH is doing :+1: