Good catch -- thank you! That now works in the example I provided.
Result 'A quick brown fox jumps over the lazy dog.'

The ironic thing is that I introduced the bug you found when moving to the shorter example; it's not in the original. The original code is much longer, and within a module I'm writing to handle SSH handshaking between a Client and remote Server. Both the original program and the example have the same symptoms though; the error message is the same.

So I've got some work to do... I now have a working (finally!) example, and a longer program with the error. I'll work at it from both ends, and post what I find here. Ideally I did something else stupid in the original, and it'll be easy to find and fix.

Edit:   Found it. Well, it was not as stupid as the short example perhaps. I wasn't getting the same data over the socket that I was sending. I kludged up some routines to calculate an md5sum on the data at different stages, and realized that, differing from what I believed about MIME::Base64, the encode_base64() method was inserting newline into the string. (I know my example didn't show the encode_base64() and decode_base64 methods(), but that was because I was getting the error without them).

So I went back to the docs for MIME::Base64 and found:

encode_base64( $bytes ) encode_base64( $bytes, $eol ); Encode data by calling the encode_base64() function. The f +irst argument is the byte string to encode. The second argument + is the line-ending sequence to use. It is optional and defaults t +o "\n". The returned encoded string is broken into lines of no more + than 76 characters each and it will end with $eol unless it is empt +y. Pass an empty string as second argument if you do not want the e +ncoded string to be broken into lines.
When I changed the $eol char from "\n" to "", the Client was able to get the full string, and it fixed the problem. :D
say  substr+lc crypt(qw $i3 SI$),4,5

In reply to Re^2: Errors in Crypt::OpenSSL::RSA (from 'RSA.xs') by golux
in thread Errors in Crypt::OpenSSL::RSA (from 'RSA.xs') by golux

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.