Handle non-armored signature
This commit is contained in:
parent
5d2d4ff451
commit
6036099b13
11
envelope.py
11
envelope.py
@ -43,7 +43,7 @@ def assume_rfc3156(msg):
|
|||||||
|
|
||||||
def assume_oldstyle(payload):
|
def assume_oldstyle(payload):
|
||||||
yield MailTest("Found BEGIN PGP SIGNED MESSAGE: message treated as old style PGP email.")
|
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 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))
|
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
|
lpart = part
|
||||||
|
Reference in New Issue
Block a user