Browse Source

Handle non-armored signature

master
nemunaire 8 months ago
parent
commit
6036099b13
  1. 11
      envelope.py

11
envelope.py

@ -43,7 +43,7 @@ def assume_rfc3156(msg):
def assume_oldstyle(payload):
yield MailTest("Found BEGIN PGP SIGNED MESSAGE: message treated as old style PGP email.")
yield payload
yield payload.encode()
@ -106,4 +106,13 @@ def check(msg, GNUPG_DIRECTORY, accept_public_key=True, beta=False):
yield MailTest("Standalone non-armored signature file discovered. Avoid using binary signature over SMTP (see RFC2015 #2. PGP data formats).", 2)
yield (lpart.get_payload(decode=True), part.get_payload(decode=True))
elif lpart is not None and part.get_filename() is not None and lpart.get_filename() is not None and lpart.get_filename()[:len(part.get_filename())] == part.get_filename():
yield MailTest("Standalone non-armored signature file discovered. Avoid using binary signature over SMTP (see RFC2015 #2. PGP data formats).", 2)
yield (part.get_payload(decode=True), lpart.get_payload(decode=True))
elif part.get_filename() is not None and (part.get_filename()[len(part.get_filename())-4:] == ".gpg" or part.get_filename()[len(part.get_filename())-4:] == ".asc") or (
payload is not None and not part.is_multipart() and part.get_payload(decode=True).find(b"-----BEGIN PGP MESSAGE-----") >= 0):
yield MailTest("Standalone PGP message discovered.")
yield part.get_payload(decode=True)
lpart = part

Loading…
Cancel
Save