-
-
Notifications
You must be signed in to change notification settings - Fork 940
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
Getting "invalid private key file." error #434
Comments
As far as I know, this library does not support .ppk files for the private key - you need to convert your private key to an OpenSSH format (e.g PEM). |
Hi, I'm having a similiar issue. I've created a private key with ssh-keygen and stored in a oracle table. When the client.Connect() method is being called I get the same error. I tried the key with FileZilla and the connection was established succesfully. |
Hi |
Hi |
Putty-key is not supported now. You may convert putty-key to openssh-key using PUTTYGEN which installed with PUTTY, and openssh-key is working well. |
SSH.Net allows a format called "ssh.com". This is the only difference in the procedure to authenticate using credentials vs procedure to authenticate via private key. |
Hi, Am having the same issue if I use .ppk key for authentication. It is working fine if I convert .ppk key to OpenSSH format. |
Putty key format is not supported by the library, same for the newest format OpenSSH is using
…Sent from my iPhone
On Aug 9, 2019, at 9:55 AM, RaviDyapa ***@***.***> wrote:
Hi,
Am having the same issue if I use .ppk key for authentication. It is working fine if I convert .ppk key to OpenSSH format.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
OpenSSH format is now supported in the develop branch. For now, there's no support Putty private key files. |
Can I use openssl to generate the private key? |
@Rob-Hague @scott-xu I'm really excited to see that SSH.NET now supports the PuTTY private key file format. I couldn't wait to try it out, but when I tried to load my key, I got an error saying 'MAC verification failed for PuTTY key file.' It works fine with PuTTYgen, though. If this issue could be fixed, that would be awesome! |
@Varorbc Would you mind sharing me a PuTTY key file that can reproduce your issue? It doesn't have to be your secret private key. |
@scott-xu passphrase is 123456
|
It works in my laptop using latest develop branch. I tried both .NET Framework 4.6.2 and .NET 9.0. |
Hi,
I am new to this SFTP communication. I have received the Private_Keys.ppk file from my IT team, which is as follows,
PuTTY-User-Key-File-2: ssh-rsa
Encryption: aes256-cbc
Comment: imported-openssh-key
Public-Lines: 6
AAAAB3NzaC1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i0
9Y9nd8z0O0HYjmCphXydgoV8nJH13zmkXq2lVqlsoeTFLpHm+fuYKGG7U5ap52lT
eVvH6jmgLcyPnqVqpM23ZhBX+yxxQZR3NofkaCNpQOEChbMayr0qSbB1DwwRn11R
D4N1ywXDmxKjqxWvbhfHVUCY5C+v1irpSZwmFNAGhSIIl6MYVWMsX2dfSTOSGalT
Private-MAC: d11ad00691481e1f6f4bedb11621574df1c93566
While creating PrivateKeyFile object,
privateKeyFile = new PrivateKeyFile(ppkfilepath);
I am getting following error,
Message: invalid private key file
Stack Trace: at Renci.SshNet.PrivateKeyFile.Open(Stream privateKey, String passPhrase)
at Renci.SshNet.PrivateKeyFile..ctor(String fileName, String passPhrase)
at Renci.SshNet.PrivateKeyFile..ctor(String fileName)
at TestApp.sftpProtocol.connectSftpServer(String strHost, Int32 iPort, String strUserName, String strPassword, Int32 iTimeout, String PPKFileName) in D:\Project\SFTP Demo\demo-master\sftp_demo\SFTP\TestApp\sftpProtocol.cs:line 36
Please advice.
Note: I am able to connect to the sftp using winscp.
The text was updated successfully, but these errors were encountered: