On the Windows machine you will have to generate from your key two files, one for the private key and the other for the public key, both in OpenSSH format.

Then from your Perl script, call Net::SSH2::auth_publickey method, passing the names of these files.

And BTW, this is how OpenSSH private and public keys look like:

salva@leon:~$ cat /tmp/id_dsa -----BEGIN DSA PRIVATE KEY----- MIIBvAIBAAKBgQDnhhDCFvCQ+ejbPAwhr2BZ1tZwGesd3lVDL1qpZ96nWo+GCLHr Xv51SQU7fW2jyo6F8u6+37p+ufNhq1ZZ4xpZW1R3KPxWwvXHDHtdQFgeHeZsA/IH YzseEzuTsFMAlI0yGDk2sMprGmZSva97I0hnVA+PazetasviDyh7T7MMKwIVAMic ktBUdfuHSrJeugTl5dkrEy0pAoGAOKQdIrpvhNKVxICfDfX/bj9EF7SmgQbV1mqg pecw0CnIsvEKJab5x1h0b9WUI7+AoeGaYALdq4ILvOA+druikey25cPJy8I3k5of TmcXBO43/Lc0f+v/0Z+Pj3xUcLsR2Ur+MS7eN4Kdei04QQ5ol0RZG3ZZ0eko+AUk smSVkkECgYEA1zUU2gAL43pLyAJqlfDXzDHWWw2wHHNfSmzYz28VzUPnqlIMh6Fx cWRx1tGWApNSq/0mv4IYFJ2DzGxODp8lJjnZ3YvP5qu6nzClEf0EEnxwdy6LpNFQ rrZixsZk9Rya09rl91okX2tZzItrXc9tD205c0kTfxZVe8j+lMFYz34CFQC5PrPD IX9Z+YmanG7JV2EVUaHv+Q== -----END DSA PRIVATE KEY----- salva@leon:~$ cat /tmp/id_dsa.pub ssh-dss AAAAB3NzaC1kc3MAAACBAOeGEMIW8JD56Ns8DCGvYFnW1nAZ6x3eVUMvWqln3q +daj4YIsete/nVJBTt9baPKjoXy7r7fun6582GrVlnjGllbVHco/FbC9ccMe11AWB4d5mw +D8gdjOx4TO5OwUwCUjTIYOTawymsaZlK9r3sjSGdUD49rN61qy+IPKHtPswwrAAAAFQDI +nJLQVHX7h0qyXroE5eXZKxMtKQAAAIA4pB0ium+E0pXEgJ8N9f9uP0QXtKaBBtXWaqCl5 +zDQKciy8QolpvnHWHRv1ZQjv4Ch4ZpgAt2rggu84D52u6KR7Lblw8nLwjeTmh9OZxcE7j +f8tzR/6//Rn4+PfFRwuxHZSv4xLt43gp16LThBDmiXRFkbdlnR6Sj4BSSyZJWSQQAAAIE +A1zUU2gAL43pLyAJqlfDXzDHWWw2wHHNfSmzYz28VzUPnqlIMh6FxcWRx1tGWApNSq/0m +v4IYFJ2DzGxODp8lJjnZ3YvP5qu6nzClEf0EEnxwdy6LpNFQrrZixsZk9Rya09rl91okX +2tZzItrXc9tD205c0kTfxZVe8j+lMFYz34= salva@leon

In reply to Re^8: Net SSH2 auth_publickey not working in Windows by salva
in thread Net SSH2 auth_publickey not working in Windows by karayan

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.