This is a reply to: 1/29/2021 1:12 PM, Jose Nobile
Can anyone help me?
My version of your code, adapted for Windows and cPanel, is as follows:
$connection = ssh2_connect($hostDomainName, $securePort,
array('hostkey'=>'ssh-rsa'));
echo "ssh2_connect: $connection";
if (ssh2_auth_pubkey_file($connection, $user,
"x.crt",
"x.key", $passphrase)) {
echo "Public Key Authentication Successful\n";
$sftp = ssh2_sftp($connection);
} else {
die('Public Key Authentication Failed');
}
Running this code produces an error:
"Starting...
ssh2_connect: Resource id #4
Warning: ssh2_auth_pubkey_file(): Authentication failed for nsr using
public key: Unable to open public key file in
C:\Dropbox\Private\Web\nsr-HMAC\upload\upload.php on line 39
Public Key Authentication Failed"
File x.crt begins:
-----BEGIN CERTIFICATE-----
File x.key begins:
"-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED"
Can anyone help me?
David Spector
Springtime Software