From 77aaca762deb951c5bc8852807f4d8c080d2075e Mon Sep 17 00:00:00 2001 From: Daniel Kahn Gillmor Date: Wed, 16 Nov 2022 17:42:54 -0500 Subject: [PATCH] ASCII armoring should not require the CRC line See the rationale from the upcoming standard: https://www.ietf.org/archive/id/draft-ietf-openpgp-crypto-refresh-07.html#name-optional-checksum --- pgpy/types.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pgpy/types.py b/pgpy/types.py index 187d3984..115128be 100644 --- a/pgpy/types.py +++ b/pgpy/types.py @@ -62,8 +62,8 @@ class Armorable(metaclass=abc.ABCMeta): # capture all lines of the body, up to 76 characters long, # including the newline, and the pad character(s) (?P([A-Za-z0-9+/]{1,76}={,2}(?:\r?\n))+) - # capture the armored CRC24 value - ^=(?P[A-Za-z0-9+/]{4})(?:\r?\n) + # optionally capture the armored CRC24 value + (?:^=(?P[A-Za-z0-9+/]{4})(?:\r?\n))? # finally, capture the armor tail line, which must match the armor header line ^-{5}END\ PGP\ (?P=magic)-{5}(?:\r?\n)? """, flags=re.MULTILINE | re.VERBOSE)