In last Source code problem is solved!
Thanks!
Thanks!
PrivateKeyFile ppkFile = new PrivateKeyFile(@"C:\Utilities\mercury.ppk",null);
I may try to peruse the source code about this since I'm also unsure of how the PrivateKey method is utilizing the key and passphrase. It's unclear to me whether or not the target host is supposed to be receiving the ppk and passphrase separately and then does the decrypting itself, or if this is the job of the SSH client, decrypting on client machine before using in connection? private static AuthenticationMethod createAuthObject(
string _uName,
bool _usePrivateKey,
string _uPassword = "",
string _ppkPassPhrase = "",
string _ppkPath = ""
)
{
PrivateKeyFile ppkFile;
if (_usePrivateKey)
{
if (_ppkPassPhrase != "")
{
ppkFile = new PrivateKeyFile(_ppkPath, _ppkPassPhrase);
}
else
{
ppkFile = new PrivateKeyFile(_ppkPath);
}
PrivateKeyAuthenticationMethod myAuth = new PrivateKeyAuthenticationMethod(_uName, ppkFile);
return myAuth;
}
else
{
PasswordAuthenticationMethod myAuth = new PasswordAuthenticationMethod(_uName, _uPassword);
return myAuth;
}
}