Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > CBC/BLOWFISH, NEWBIE HELP - CAN'T DECRYPT FROM SAVED FILE

Reply
Thread Tools

CBC/BLOWFISH, NEWBIE HELP - CAN'T DECRYPT FROM SAVED FILE

 
 
Homer J.
Guest
Posts: n/a
 
      11-10-2004
Hello,

I'm wondering if the experienced PERL people can help me here.

I'm stuck. I'm trying to use Crypt::CBC using Blowfish to encrypt
some data. I can get it to encrypt and decrypt OK as long as I assign
the ciphertext to a variable and decrpyt it from that variable all
within the same script execution. However, when I save the ciphertext
to a text file and then subsequently open the file and read in the
ciphertext to a variable and finally try to decrypt the cipheredtext I
get garbage instead of my original test message.

Someone please help! I'm sure it's, something obviously wrong that
I've done, but I can't seem to figure out what it is.

Homer
http://www.velocityreviews.com/forums/(E-Mail Removed)
 
Reply With Quote
 
 
 
 
Greg Schmidt
Guest
Posts: n/a
 
      11-10-2004
On 10 Nov 2004 12:39:49 -0800, Homer J. wrote:

> I'm stuck. I'm trying to use Crypt::CBC using Blowfish to encrypt
> some data. I can get it to encrypt and decrypt OK as long as I assign
> the ciphertext to a variable and decrpyt it from that variable all
> within the same script execution. However, when I save the ciphertext
> to a text file and then subsequently open the file and read in the
> ciphertext to a variable and finally try to decrypt the cipheredtext I
> get garbage instead of my original test message.
>
> Someone please help! I'm sure it's, something obviously wrong that
> I've done, but I can't seem to figure out what it is.


Are you writing and reading the file in binary mode? Text mode may do odd
things to binary data such as cipertext.

--
Greg Schmidt (E-Mail Removed)
Trawna Publications http://www.trawna.com/
 
Reply With Quote
 
 
 
 
Homer J.
Guest
Posts: n/a
 
      11-14-2004
Greg Schmidt <(E-Mail Removed)> wrote in message news:<3g4d2q9c1ghp$(E-Mail Removed)>...
> On 10 Nov 2004 12:39:49 -0800, Homer J. wrote:
>
> > I'm stuck. I'm trying to use Crypt::CBC using Blowfish to encrypt
> > some data. I can get it to encrypt and decrypt OK as long as I assign
> > the ciphertext to a variable and decrpyt it from that variable all
> > within the same script execution. However, when I save the ciphertext
> > to a text file and then subsequently open the file and read in the
> > ciphertext to a variable and finally try to decrypt the cipheredtext I
> > get garbage instead of my original test message.
> >
> > Someone please help! I'm sure it's, something obviously wrong that
> > I've done, but I can't seem to figure out what it is.

>
> Are you writing and reading the file in binary mode? Text mode may do odd
> things to binary data such as cipertext.


Hi Thanks for your replies. Yes I think that did it! Thank you.

Homer
 
Reply With Quote
 
Homer J.
Guest
Posts: n/a
 
      11-14-2004
Bob Walton <(E-Mail Removed)> wrote in message news:<4192c665_3@127.0.0.1>...
> Homer J. wrote:
>
> ...
> > I'm stuck. I'm trying to use Crypt::CBC using Blowfish to encrypt
> > some data. I can get it to encrypt and decrypt OK as long as I assign
> > the ciphertext to a variable and decrpyt it from that variable all
> > within the same script execution. However, when I save the ciphertext
> > to a text file and then subsequently open the file and read in the
> > ciphertext to a variable and finally try to decrypt the cipheredtext I
> > get garbage instead of my original test message.

>
> perldoc -f binmode
>
> ...
> > Homer

> ...


Yes I think this did it. Binmode, seems to do the trick. Thanks all for your help.

Homer
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
decrypt challenge - perl encrypt with ruby decrypt aktxyz@gmail.com Ruby 1 06-16-2007 01:30 PM
Saved Mail Gone and Sent Mail Not Being Saved Gregg Firefox 6 03-06-2006 02:13 AM
how to encrypt a C data and write a bin file and read a bin at run time and decrypt C data sweety C Programming 9 02-07-2006 05:28 PM
Automatically controlling where a file will be saved based on file extension and/or origin Daniel Prince Firefox 6 12-11-2004 10:58 PM
Encrypt/Decrypt a structured file kevininstructor@state.or.us ASP .Net 1 09-25-2004 05:25 AM



Advertisments