-----Original Message----- From: RICHARD FERNANDEZ [mailto:[EMAIL PROTECTED] Sent: Thursday, April 06, 2006 12:20 PM To: beginners@perl.org Subject: Crypt::GPG produces an empty cleartext file
Hi Folks, I have a job that takes in an encrypted file and decrypts it using Crypt::GPG. <code> for my $encrypted_file (@files) { open(CIPHERTXT, $encrypted_file) or croak "Can't open encrypted_file: $encrypted_file\n"; my @ciphertxt = <CIPHERTXT>; my($cleartxt, $signature) = $gpg -> decrypt([EMAIL PROTECTED]); # File names must have a ".extension" on them if they're encrypted # we will strip off the last "dot" and everything after it to name the # clear text file my $filename = (split /\.\w+$/, $encrypted_file)[0]; open(CLEARTXT, ">", "$filename") or croak "Can't write to $filename: $!\n"; print CLEARTXT $cleartxt or croak "Can't print cleartext: $!\n"; close CLEARTXT or croak "Can't close <CLEARTXT>?\n"; push @processed_files, $filename or croak "Can't create list of decrypted files!\n"; } </code> Mostly, this works as I expect, but once in a blue moon we get a ciphertext that produces a 0 byte cleartext file when run through the above code. When I decrypt the file manually (gpg --decrypt <filename> > clear.txt ) I get a good (readable) cleartext file. Anyone have any ideas about how to fix this? Any help is appreciated! richf -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response> ******************************************************************** What version of Crypt:GPG are u using? Derek Bellner Smith Unix Systems Engineer Cardinal Health Dublin, Ohio 614-757-5000 Main 614-757-8075 Direct 614-652-4336 Fax [EMAIL PROTECTED] Working together. For life.(sm) _________________________________________________ This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited. Dansk - Deutsch - Espanol - Francais - Italiano - Japanese - Nederlands - Norsk - Portuguese - Svenska: www.cardinalhealth.com/legal/email -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>