Open simao opened 1 year ago
Hey, I've already looked at ssh-keys
previously too and I think it would be great to integrate it! (getting rid of the openssl
dependency was on the roadmap for a long time too...)
I'll be happy to merge if you can work on it :v:
I've now almost replaced entire key handling with ssh-key (except for PKCS#8 which they don't have yet)
Hi,
There is a lot of custom code to encode/decode keys and ssh payloads in russh-keys. I think this code is error prone and might have some bugs, for example the following key, used in the russh-keys test suite:
Cannot be parsed by my version of openssh (9.2), but can be parsed with russh-key. Presumably it was generated/encoded with russh? Possibly this is an error on my side in this case, but my point is, these kind of problems are more likely to exist with a custom implementation, IMO.
There is a dependency on openssl, to use rsa keys and a few other things. To use openssl we need to use unsafe code. Moving to a rust only implementation would go towards at some point stop using openssl and maybe eventually stop using unsafe code (the cryptovec issue would also have to be addressed).
ssh keys encoding/decoding is already done by other rust only crates like https://docs.rs/ssh-key/latest/ssh_key/. That crate also supports encryption and signature verification, so we could potentially avoid using openssl and just use pure rust, even when verifying signatures and encrypting payloads. ssh-keys is maintained by the RustCrypto project which has more people working on it and there is more scrutiny over the implementation.
The api to load openssh keys using russh-key is a bit awkward to use, for example, to parse an openssh key from a string, you need to split the string with spaces and then call
parse_public_key_base64
. Usingssh-key
would give us a better api.We could potentially at some point reexport the ssh-key types, which would also provide better integration with other crates, that might also use it. For example, ssh-key has a
serde
feature that provides Serializer/Deserializer instances for keys.To be clear, I think there is still functionality worth keeping in russh-keys, this is just about using ssh-key where it can be used and keep using russh-keys for the rest.
That all said, changing to use ssh-keys would be a lot of work, so I wanted to ask before I work on it, would you consider a PR that implement this change, or you have a strong reason to keep using russh-keys?