I am trying to get an ssh-connection established.

$av_obj_SSH = Net::SSH2->new();

works - easy!

$av_obj_SSH->connect($computername);

works as well!

$av_obj_SSH->auth_publickey($ENV{USER},"$ENV{HOME}/.ssh/t_zertifikat_a_test.pub","$ENV{HOME}/.ssh/t_zertifikat_a_test.ppk")

gets error:

Invalid key data, not base64 encoded (-16 LIBSSH2_ERROR_FILE) at

I have generated a keypare by puttygen!

The file stored by puttygen for the public key (...pub):

---- BEGIN SSH2 PUBLIC KEY ---- Comment: "rsa-key-for-test-purposes" AAAAB3NzaC1yc2EAAAADAQABAAABAQCV5LKBeYj97VRCpS0JDzErTSIMV1xjaVla Notc1kphN7QEWMT1WDWKtYlSIBFxQoAfavKfXHsVR/ugvjuYrbjee6IxiU3r43TT +enudXpklfLwzv8fibLy0c1pLepyPzxBGSNN2FL+Z+BnGjBprxr+b0x/Q5xLulB8 KEZPWGhYPu1seV5ShVQDEvAoHiTj4sixv07u4OCyveSSrIv+gdAEZAObb589eC5I sBGc/LSJnL9DCFeqNbUsZ9eGNUw+pD+KtEaUwsyWPr39sb1wnZOB1IstnLWGX5Ba a/TgqsyJv+zt6PfCaizj7gKZklJdoUXaeQkeEnGj/Th0W3hzMSrp ---- END SSH2 PUBLIC KEY ----

The file generated by puttygen for the private key (...ppk):

PuTTY-User-Key-File-3: ssh-rsa Encryption: none Comment: rsa-key-for-test-purposes Public-Lines: 6 AAAAB3NzaC1yc2EAAAADAQABAAABAQCV5LKBeYj97VRCpS0JDzErTSIMV1xjaVla Notc1kphN7QEWMT1WDWKtYlSIBFxQoAfavKfXHsVR/ugvjuYrbjee6IxiU3r43TT +enudXpklfLwzv8fibLy0c1pLepyPzxBGSNN2FL+Z+BnGjBprxr+b0x/Q5xLulB8 KEZPWGhYPu1seV5ShVQDEvAoHiTj4sixv07u4OCyveSSrIv+gdAEZAObb589eC5I sBGc/LSJnL9DCFeqNbUsZ9eGNUw+pD+KtEaUwsyWPr39sb1wnZOB1IstnLWGX5Ba a/TgqsyJv+zt6PfCaizj7gKZklJdoUXaeQkeEnGj/Th0W3hzMSrp Private-Lines: 14 AAABAHTpnWWpkvVkIH2e8gKH6/T3Q6BWn4QWjo/zzT2LExbC6NEfH/ixZYmcUNBS nOg3U1GuDDHKY2JU8+oLltZeYbx+uCJlEvbzQZN48UKCNQWxg3zaJ1nFAGOuysXH /34+3lN0NPopyYoPIZOpdKtp3ecojoURCh5y4wYEL9sBfNmegK7h71DTI9nmtyEh GBZ7WqgPlXhO2HG4HciKouAuQy6j2aWmbIOj0lXxgw/DOzffDrtAv5lj9tiOv9MM ubKxOueks3+Nl1jGSahTkuliy1rBgE/+bwxdjkS+seHwxa307MQMfS04YwqGlNNJ vRw3qeQFGK85lCIYTWWpJJhRe/UAAACBANYMY0hdAc1r/3W2cJQ2xWAB38PJmAK1 l2BSOlx7ziXfjBvLH7kvLbsUSuTWJOk1nEwfg0iQD+73vucbYAh1LPenKKXQTk05 S+MATYlJnnvJ9J06MxNl0hBihUUaQmq1kIZOw6P75eT2Mpvptnpmf02I9kTLWT1w HNNYGloSXDlTAAAAgQCzRWjxsQKsaUdtZ1hZ1Z5Ky+W+9c5cGwGMlkNXslVVu4ma Jns/g/mUPADY5PXWinGR87/68Zqgox76g8K+/A7tvQPSd3mOY/81UrvN9j0nkPKE 8CibkUmXdHaWNd16lyDPAEHIQXfdUj3qezNZNckPcUW5cutZMbnTMaqX5yd3UwAA AIEAiu5YanwXI4Ex+MYHr3Knk6opTMaQIZrq0eqh4akuhCas9s02xQZiNweccWMx YDZpt0+xliHcWT9JV2uqKe4TyvrFDQhl8inlwEJomRi9829mQ4Ns93+EoYTcFo2I ORA/pb19k71pY4X+IFRB3nZBOFcx3HkSgOHr6BSXU4BJUEQ= Private-MAC: 70182c36f26b637f19ef0f3c203734177b34652c88ff84705a23c660d +8e373bf

The code to paste into the authorized_keys file on the target system:

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCV5LKBeYj97VRCpS0JDzErTSIMV1xjaV +laNotc1kphN7QEWMT1WDWKtYlSIBFxQoAfavKfXHsVR/ugvjuYrbjee6IxiU3r43TT+en +udXpklfLwzv8fibLy0c1pLepyPzxBGSNN2FL+Z+BnGjBprxr+b0x/Q5xLulB8KEZPWGhY +Pu1seV5ShVQDEvAoHiTj4sixv07u4OCyveSSrIv+gdAEZAObb589eC5IsBGc/LSJnL9DC +FeqNbUsZ9eGNUw+pD+KtEaUwsyWPr39sb1wnZOB1IstnLWGX5Baa/TgqsyJv+zt6PfCai +zj7gKZklJdoUXaeQkeEnGj/Th0W3hzMSrp rsa-key-for-test-purposes

The keys shown here are only generated for the test purposes and not used in production mode!

What can I do to get it working?

Regards Kallewirsch

In reply to Net::SSH2 not base64 encoded by averlon

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.