add supported for pgp public keys attached as quoted-printable

This commit is contained in:
askiiart 2024-02-28 09:21:59 -06:00
parent 16c67ee819
commit 9487a90c31
Signed by untrusted user who does not match committer: askiiart
GPG key ID: BC3800E55FB54D67

View file

@ -21,6 +21,7 @@ with open(f'{XDG_DATA_HOME}/gpg-email-helper/log', 'a') as log:
if email.rfind('-----BEGIN PGP PUBLIC KEY BLOCK-----') != -1 and email.rfind('-----END PGP PUBLIC KEY BLOCK-----') != -1:
public_key = email[email.rfind(
'-----BEGIN PGP PUBLIC KEY BLOCK-----'):email.rfind('-----END PGP PUBLIC KEY BLOCK-----')+35]
public_key = public_key.replace('=3D', '=') # quoted-printable attachments have the equals sign escaped as =3D apparently
log.write(
f'Attempted to import key from email: {gpg.Context(armor=True).key_import(public_key.encode())}\n')