Missing 'END PGP MESSAGE' not detected

David Shaw dshaw at jabberwocky.com
Wed Jan 19 18:46:10 CET 2011


On Jan 19, 2011, at 12:09 PM, Kavalec wrote:

> 
> 
> David Shaw wrote:
>> 
>> On Jan 19, 2011, at 10:46 AM, Kavalec wrote:
>> 
>>> Is there a way to force the decrypt to fail on a missing 'END PGP
>>> MESSAGE' ?
>> 
>> ... take one of your truncated files and run:
>> 
>> gpg --list-packets the-truncated-file.asc
>> 
>> Look for a line that reads "mdc_method: 2".  If you see that, you are
>> protected from truncation no matter what your transport system does.
>> 
>> David
>> 
>> 
> 
> Thanks David, that does give a 'fatal' error indicator, which we can test
> for.

You can either use --status-fd and look for:
  [GNUPG:] GOODMDC
or
  [GNUPG:] BADMDC

Or just check the return code from the gpg binary.  If it fails (for whatever reason), the return code won't be zero.

David




More information about the Gnupg-users mailing list