I'm trying to write some code capable of authenticating with a private key on windows.
I generate my key with no passphrase:
Generating public/private rsa key pair.
Enter file in which to save the key (/home/user/.ssh/id_rsa): client_k
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in client_key.
Your public key has been saved in client_key.pub.
The key fingerprint is:
The key's randomart image is:
|O=* . o+. |
|X=.o . . .o. |
|+= o o . ... |
|E.o . B...+ . |
|... +.=S* o |
|.. +.+ = . |
|.. o + o |
|. . o . |
| o |
The key can be used successfully to authenticate:
c:\var\client>ssh -i client_key localhost
Last login: Thu Aug 22 16:34:22 2019
My perl code is very simple at the moment:
my %params = (
"protocol" => '2',
"use_pty" => 0,
"options" => ["stricthostkeychecking no"],
"identity_files" => ["client_key"],
"debug" => 1,
$ssh = Net::SSH::Perl->new($server, %params);
But executing it returns Wrong key type.
localhost: Reading configuration data C:\Users\user\.ssh\config
localhost: Reading configuration data C:\windows\ssh_config
localhost: Connecting to localhost, port 22.
localhost: Remote version string: SSH-2.0-OpenSSH_8.0
localhost: Remote protocol version 2.0, remote software version OpenSS
localhost: Net::SSH::Perl Version 2.14, protocol version 2.0.
localhost: No compat match: OpenSSH_8.0.
localhost: Connection established.
localhost: Sent key-exchange init (KEXINIT), waiting for response.
localhost: Using firstname.lastname@example.org for key exchange
localhost: Host key algorithm: ssh-ed25519
localhost: Algorithms, c->s: email@example.com <implicit>
localhost: Algorithms, s->c: firstname.lastname@example.org <implicit>
localhost: Generating ephemeral key pair.
localhost: Entering Curve 25519 Key Exchange.
localhost: Sent client public key, waiting for reply.
localhost: Received host key, type 'ssh-ed25519'.
localhost: Host 'localhost' is known and matches the host key.
localhost: Verifying server signature.
localhost: Send NEWKEYS.
localhost: Waiting for NEWKEYS message.
localhost: Enabling encryption/MAC/compression.
localhost: Sending request for user-authentication service.
localhost: SSH2_MSG_EXT_INFO received
localhost: SSH Extension activated: server-sig-algs=ssh-ed25519,ssh-rs
localhost: Service accepted: ssh-userauth.
localhost: Trying empty user-authentication request.
localhost: Authentication methods that can continue: publickey,passwor
localhost: Next method to try is publickey.
localhost: Trying pubkey authentication with key file 'client_key'
Wrong key type at C:/Strawberry/perl/site/lib/Net/SSH/Perl/Auth/Public
+Key.pm line 83.
I've tried generating DSA type keys and the error is the same. Googling it is not helping either.
Any help appreciated!