I'm not familiar with your exact problem, but I have worked a lot with perl and encryption. Since I don't have "Crypt::OpenSSL::RSA" installed, I used the openssl command. My documentation for openssl shows input from a file. ( Just a note, since non printable characters are very important in encryption/decryption I use a "|" before/after any printed results so I can see if any characters {carriage return, etc} are added. Any remember almost all encryption/decryption results are stated in bits, so be careful about wanting character results. )

As you can see we differ already in step 1 ( getting the SHA1 ). Your result may not be in printable hex format, and therefore you may be correct, but again I'm not familiar with the exact problem. If you have the openssl command on your system, try doing this manually to get the right answer and then implement the process using perl. Encryption is never easy!

#!/usr/local/bin/perl -w # # RSA_encryption_Ducth_iDeal_payment # use strict; use MIME::Base64 (); use Digest::SHA1 qw(sha1 sha1_hex sha1_base64); #use Crypt::OpenSSL::RSA; my $string = "0021232117891234AcquirerStatusRes2004-11-02T15:05:03.750 +ZSuccess"; print ("\n\|$string:$string| (",length($string),")\n\n"); open (CTX, ">", "./ctx") or die "Could not open: $! \n"; print CTX "$string"; close CTX; my $sha1 = qx|openssl dgst -sha1 ./ctx|; print ("\n\$sha1:|$sha1| (",length($string),")\n\n"); #SHA encryption my $ctx = Digest::SHA1->new; $ctx->add($string); my $digest = $ctx->digest; my $len = length($digest); print ("SHA-1 DIGEST:$digest.. ($len)\n\n"); #RSA-encryption over the digest #Base64 encoding: my $encoded = MIME::Base64::encode($digest); my $len1 = length($encoded); print ("ENCODE:$encoded ($len1)\n\n"); __END__ #The result has to be (172 chars): #db82/jpJRvKQKoiDvu33X0yoDAQpayJOaW2Y8zbR1qk1i3epvTXi+6g+QVBY93YzGv4w+ +Va+vL3uNmzyRjYsm2309d1CWFVsn5Mk24NLSvhYfwVHEpznyMqizALEVUNSoiSHRkZUDf +XowBAyLT/tQVGbuUuBj+TkblY826nRa7U=

"Well done is better than well said." - Benjamin Franklin


In reply to Re: RSA encryption for (Ducth) iDeal payment by flexvault
in thread RSA encryption for (Ducth) iDeal payment by Eric66

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.