diff --git a/gpgmymail b/gpgmymail index f9b4308..92fded4 100755 --- a/gpgmymail +++ b/gpgmymail @@ -223,8 +223,7 @@ def encrypt( *, unconditionally_encrypt: bool = False, encoding: str = DEFAULT_ENCODING, - ignore_errors: bool = False, - decode_before_encrypting: bool = False + ignore_errors: bool = False ) -> str: """Encrypt given message @@ -263,14 +262,13 @@ def encrypt( # make necessary changes to message # this function is quite clunky and seems to throw exceptions from time to # time; if we can't make the necessary changes we want to just continue - if decode_before_encrypting: - try: - message = decode_email(message) - except Exception as e: - if ignore_errors: - pass - else: - raise e + try: + message = decode_email(message) + except Exception as e: + if ignore_errors: + pass + else: + raise e gpg = gnupg.GPG() gpg.encoding = encoding @@ -307,6 +305,10 @@ def encrypt( if key.lower() not in headers_not_to_override: encmsg[key] = value + # mark as confirming to pEp: https://blog.jak-linux.org/2019/06/13/encrypted-email-storage/#pretty-easy-privacy-pp + set_email_header(encmsg, 'Subject', PEP_SUBJECT) + set_email_header(encmsg, 'X-pEp-Version', '2.1') + # we have encrypted the email, set our gpgmymail header appropriately set_email_header(encmsg, 'X-gpgmymail-Status', 'encrypted') @@ -333,8 +335,6 @@ def main() -> None: help="Encrypt mail unconditionally. By default, mail is not encrypted if it is already encrypted.") parser.add_argument('--ignore-errors', action="store_true", help="Ignore errors at certain error-prone points of the script.") - parser.add_argument('--decode', action="store_true", - "Attempt to decode quoted-printable and base64 parts to latin-1 before encrypting a message") parser.add_argument('recipient', nargs='*', help="Key ID or email of keys to encrypt for") args = parser.parse_args() @@ -348,8 +348,7 @@ def main() -> None: args.recipient, unconditionally_encrypt=args.unconditional, encoding=args.encoding, - ignore_errors=args.ignore_errors, - decode_before_encrypting=args.decode + ignore_errors=args.ignore_errors )) if __name__ == '__main__':