Currently League\Flysystem\Sftp\SftpAdapter::getPrivateKey() does not check the bool result of RSA::loadKey() where false indicates error.
|
public function getPrivateKey() |
|
{ |
|
if ("---" !== substr($this->privateKey, 0, 3) && is_file($this->privateKey)) { |
|
$this->privateKey = file_get_contents($this->privateKey); |
|
} |
|
|
|
$key = new RSA(); |
|
|
|
if ($password = $this->getPassword()) { |
|
$key->setPassword($password); |
|
} |
|
|
|
$key->loadKey($this->privateKey); |
|
|
|
return $key; |
I hit this due to phpseclib/phpseclib#1372 where by regular OpenSSH generated keys wouldn't load when generated with recent versions.
Is it fair to say that this should be detected and a LogicException raised to ease identification of the problem? At present you end up with the general "Could not login ..." exception.
Currently
League\Flysystem\Sftp\SftpAdapter::getPrivateKey()does not check the bool result ofRSA::loadKey()where false indicates error.flysystem-sftp/src/SftpAdapter.php
Lines 266 to 280 in 518ac7d
I hit this due to phpseclib/phpseclib#1372 where by regular OpenSSH generated keys wouldn't load when generated with recent versions.
Is it fair to say that this should be detected and a
LogicExceptionraised to ease identification of the problem? At present you end up with the general "Could not login ..." exception.