sshnet / SSH.NET

SSH.NET is a Secure Shell (SSH) library for .NET, optimized for parallelism.
http://sshnet.github.io/SSH.NET/
MIT License
3.88k stars 917 forks source link

Changed Private Key Regex to be more tolerant regarding new lines at end of key file #1344

Closed staecthSICKAG closed 3 months ago

staecthSICKAG commented 3 months ago

SSH.NET so far threw an unhelpful error message regarding an invalid key file if there was a new line between the key data and the end line. The changed regex now allows zero or one empty line.

This is now allowed

...
dw+2Ggyq5W5hl3PDTMTqn8Pc+cwmPdVe4bkNqxbCHe2omZXpNIgC31wrMBvkyUYv
pY8rMoBXqgm9hC5JsXzn6Z6X1kpGFhDjkNSdzx4jYzw=

-----END RSA PRIVATE KEY----- 
staecthSICKAG commented 3 months ago

Just curious, do you know how the key was generated?

Not really it was a key handed down to me from another department. I would not discard the possibility that someone meddled with it to make it more aesthetically pleasing.