Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2024-04-26 00:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found