GnuPG only *sometimes* returns the filename for the plaintext.

* We can't split twice at first, because sometimes there isn't a third field
   in the string.
 * There isn't any rhyme or reason to when the filename is present or
   missing. It just is.
testing/mmn/mktime_takes_localtime_not_gmtime
Isis Lovecruft 2013-05-27 07:46:54 +00:00
parent 1c3f0c3c9a
commit 1d326f8808
No known key found for this signature in database
GPG Key ID: A3ADB67A2CDB8B35
1 changed files with 8 additions and 4 deletions

View File

@ -1139,10 +1139,14 @@ class Crypt(Verify):
elif key == "SIGEXPIRED":
self.status = 'sig expired'
elif key == "PLAINTEXT":
fmt, self.data_timestamp, self.data_filename = value.split(' ', 2)
## GnuPG give us a hex byte for an ascii char corresponding to
## the data format of the resulting plaintext,
## i.e. '62'→'b':= binary data
fmt, dts = value.split(' ', 1)
if dts.find(' ') > 0:
self.data_timestamp, self.data_filename = dts.split(' ', 1)
else:
self.data_timestamp = dts
## GnuPG give us a hex byte for an ascii char corresponding to
## the data format of the resulting plaintext,
## i.e. '62'→'b':= binary data
self.data_format = chr(int(str(fmt), 16))
else:
Verify.handle_status(key, value)