Hi folks, I have a problem with the functional use of Crypt::RC4. I can encrypt and decrypt text, but once I have the plaintext from the decryption I have only binary data. For example, with this code:
#!/usr/bin/perl use CGI qw(:all); use Crypt::RC4; use strict; my $encrypted = param("encrypted"); my $decrypted = RC4($encrypted,"mykey"); print "Content-Type: text/html\n\n"; print "<b>Encrypted Data: $encrypted</b><br><br>"; print "<b>Decrypted Data: $decrypted</b><br><br>";
I get a value of "¡4Ï$²M%®4¬õDšê«˜H" for $decrypted. The value of $encrypted is "ÖäbŸ€ U)ÐÀ&$", which was sent to me through a GET query, encoded as: "%A0%D6%E4b%9F%80%09U%29%D0%C0%26%1A%24". The actual value of $decrypted should, in some way, end up being "This is a test". I've tried simple stuff like MIME::Base64, but I'm pretty much ending up clueless on this. If I go straight through with a regular perl script, with everything done inside, such as this:
my $encrypted = RC4("thisisatest",'This is a test'); my $decrypted = RC4("thisisatest",$encrypted);
Then the value of $decrypted is proper ASCII. I suspect that part of the problem may be that the encryption operation is taking place on a seperate system that I have no control over running Windows 2k and IIS, with encryption taking place with Visual Basic. Could it be that the two systems use a different output format and I have to do some kind of conversion?

Oh, please, grant me the wisdom,

--
Owlclown
"You can cage the singer but not the song."
-- Harry Belafonte

In reply to Converting binary from Crypt::RC4 by owlclown

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.