I am trying to sign my message with my SSH private key which is in ~/.ssh/id_rsa. But on using Crypt::RSA for signing i keep getting error. Code used by me is

use strict; use warnings; use Crypt::RSA; my $rsa = new Crypt::RSA ( ES => 'PKCS1v15' ); my $pkey = new Crypt::RSA::Key::Private ( Filename => '/home/abc/.ssh +/id_rsa' ); print $pkey;

The error is of this type

Number found where operator expected at (eval 21) line 6, near "ZapzlA +9gZ8 23" (Missing semicolon on previous line?) Bareword found where operator expected at (eval 21) line 6, near "23mq +j2RsKOF0Lal7YbjYFkDE7YrLPktf0FNNYvn6BjKZDlyQfpWnk8dP3crjoown" (Missing operator before mqj2RsKOF0Lal7YbjYFkDE7YrLPktf0FNNYvn6BjK +ZDlyQfpWnk8dP3crjoown?) Number found where operator expected at (eval 21) line 9, near "QUgHQA +J4R 34" (Missing semicolon on previous line?) Bareword found where operator expected at (eval 21) line 9, near "34Cs +y0lcx" (Missing operator before Csy0lcx?) Having no space between pattern and following word is deprecated at (e +val 21) line 10.

there are more messages like the one above and then at last line i get

Can't use an undefined value as a HASH reference at /usr/local/share/perl/5.14.2/Crypt/RSA/Key/Private.pm line 217.

I also want to mention here that i also tried using Crpyt::RSA::Key::Private::SSH but i am not able to get the syntax correct, thus not able to understand if this is solution or not. Not much is given on cpan on how to use it.


In reply to Using Crypt::RSA for data signing in perl by shivam99aa

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.