Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Encrypt text in perl and decrypt in a windows tool

by jettero (Monsignor)
on Jun 10, 2010 at 13:42 UTC ( #844005=note: print w/ replies, xml ) Need Help??


in reply to Encrypt text in perl and decrypt in a windows tool

Normally you wouldn't use Crypt::Blowfish directly. Choose Crypt::CBC and make sure to use binmode where necessary. Most likely you forgot a bunch of sticky little details like padding and initialization vectors and things. Let CBC do the work:

my $cipher = Crypt::CBC->new(-key => 'my secret key', -cipher => 'Blow +fish'); my $crypted = $cipher->encrypt("blarg!!"); my $text = $cipher->decrypt($crypted); # blarg


Comment on Re: Encrypt text in perl and decrypt in a windows tool
Download Code
Re^2: Encrypt text in perl and decrypt in a windows tool
by asidnayak (Initiate) on Jun 10, 2010 at 14:19 UTC
    Below is my code: -----------------------
    use Crypt::CBC; use Crypt::Blowfish; my $key = "abcdefghijlmnopqrstuvwxyz"; my $cipher = Crypt::CBC->new( -key => "$key", -cipher => 'Blowfish', ); my $ciphertext = $cipher->encrypt("3769-198501-21002"); my $plaintext = $cipher->decrypt($ciphertext); print "$key\n"; print "$ciphertext\n"; print "$plaintext\n";
    ------------------------------ The value of "$ciphertext" is send as part of mail body. I want to decrypt the value of "$ciphertext" using a Windows based tool. Please advice
      I really don't think the platform matters at all. This just isn't a "windows" vs. "<platform of choice>" question. Basically, it sounds to me like you need to parse the email body and feed it to encrypt()/decrypt(). You're either going to need to figure how how to do that (see perlretut and Mail::Box and things like that); or try to get a co-worker to do it. If you're looking for a windows specific tool (other than Perl I guess), this just isn't the right site.

      UPDATE: It sounds like you don't need Perl, you need a windows email tool. This just isn't a Perl question I guess.

        I just want to encrypt a string and send the encrypted output as part of the mail body which will contain other data. The end user has to only copy the encrypted part from the mail and try to decrypt it in a window based tool. I don't need the whole mail body to be encrypted/decrypted.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://844005]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2014-08-22 01:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (145 votes), past polls