-
-
Notifications
You must be signed in to change notification settings - Fork 890
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot connect with OpenSSH password protected RSA private key #1490
Comments
Encrypted OpenSSH private keys are, sadly, not supported. Based on my experiments, to date, it seems that PHP is just waaay too slow to do the bcrypt-inspired password derivation. The following comment (from the 3.0 branch) elaborates: phpseclib/phpseclib/Crypt/Common/Formats/Keys/OpenSSH.php Lines 95 to 120 in dc6ccb2
Maybe PHP8's JIT will make it more feasible idk. |
Hi @terrafrost that makes total sense. I kept trying my private OpenSSH key and that kept failing, but with a suggestion tried generating a key using PEM and that worked as expected. Thanks a lot for your reply. |
Encrypted OpenSSH private keys are now supported as of this commit: |
I'm trying to connect to a remote SFTP server using a private RSA (PRIVATE_FORMAT_OPENSSH) key, which is password protected but the connection is never stablished. Debugging it, it seems that the connection isn't ever attempted as the key modulus isn't loaded.
This happens for both 2.0.25 version and 2.0.27
Debugging it step by step I get to
_parseKey()
line 1484 (in this case$options
is equals to aes256-ctr bcrypt) on RSA.php file, which check the key options and in this case the key has an encryption, not meeting the criteria for this check.After that, and going through a few more checks, I get to
_privatekey_login()
line 2548 on SSH2.php, which tries to get the publicKey for the private key I'm using, that goes back to RSA.php which checks if we have$this->modules
loaded and nothing has been loaded, returning false and login process failing prematurely.If I try login in with a private key that isn't pwd protect the process works just fine.
Could anyone help me bring some light to this, I'm pretty much stuck at this point and don't know what to search for to try and workaround/resolve this issue.
I'm running OpenSSL 1.1.1 on Mac High Sierra
The text was updated successfully, but these errors were encountered: