Decryption using GnuPG:Interface and Perl

christopher.a.feathers@accenture.com christopher.a.feathers@accenture.com
Tue Jun 19 17:31:01 2001


Can't seem to get #2 to work - do you have an example?

-Chris



                                                                                                                    
            Frank Tobin                                                                                             
            <ftobin@uiuc.edu>            To:     Christopher A. Feathers@Accenture                                  
                                         cc:     GnuPG Users List <gnupg-users@gnupg.org>                           
            06/18/2001 04:52 PM          Subject:     Re: Decryption using GnuPG:Interface and Perl                 
                                                                                                                    
                                                                                                                    




christopher.a.feathers@accenture.com, at 10:53 on Mon, 18 Jun 2001, wrote:

    I am trying to wrap some of the GnuPG functions in Perl so I can
enforce
    some logging (an a few other reasons).  l am running into a problem
when I
    attempt decrypt an pass in a bad passphrase - a scenario that is quite
    possible.  I get a "Broken pipe" printed to STDOUT and my script cannot
    continue.  Is there a way to catch the fact that the passphrase was bad
    before attempting to print the encrypted file's contents to stdin as
given
    in the GnuPG::Interface examples?

Three things you can do, off of the top of my head:

1: Get the PID of the running GnuPG process (the return from "decrypt"),
and check if it's still running (send a signal of 0).

2: Read the status-fd from GnuPG; it would report a bad/good passphrase
before you had to send in the input.

3: Use the test_default_key_passphrase method of GnuPG::Interface to
pre-check the passphrase.


--
Frank Tobin         http://www.uiuc.edu/~ftobin/