tmds / Tmds.Ssh

.NET SSH client library
MIT License
177 stars 10 forks source link

Add support for encrypted private keys. #207

Closed jborean93 closed 2 months ago

jborean93 commented 3 months ago

Adds support for using encrypted private keys with user authentication. This implementation support private keys encrypted with the PKCS#1 and OpenSSH PEM formats. The AES and ChaCha20-Poly1305 ciphers allowed by each format has been implemented in this change.

Fixes: https://github.com/tmds/Tmds.Ssh/issues/202

jborean93 commented 3 months ago

I tried my best to clean up the Bcrypt KDF implementation from SSH.NET but I'm sure there are probably further optimisations that could be implemented. The good news is it works with some test vectors I found and the tests when they run.

tmds commented 3 months ago

@jborean93 thanks for working on this! I've added some high level comments about code organization. I'll try to do a more in depth review in the coming week.

tmds commented 2 months ago

Thanks a lot @jborean93!

jborean93 commented 2 months ago

Thanks for the review and looking through the changes!