-
-
Notifications
You must be signed in to change notification settings - Fork 897
Description
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
/**
* Attempts to connect to server
*
* @return void
*/
public function connect(): void
{
if (!$this->canExecute()) {
$private_key = file_get_contents($this->ssh_auth_key);
$key = new RSA();
$key->setPassword($this->ssh_auth_pwd);
$key->loadKey($private_key);
//Remote server's ip address or hostname
$this->connection = new SFTP($this->ssh_host);
if (!$this->connection->login($this->ssh_auth_user, $key)) {
SFTPErrorHandler::logError($this->connection, SFTPErrorHandler::AUTHERROR);
}
}
}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