Table of Contents

Lacre - ongoing work

  1. “Great renaming” — our fork is ours, let's reflect it with unifying the names used all over the code (see issue 81).

Reliability improvements

Research: avoiding message transformation

Python's email module provides a set of parsers for email messages, among them:

The problem with the first approach is that if we choose to encrypt an EmailMessage, its contents is serialised by an appropriate email.generator implementation, instead of producing the original content. This is OK for payloads like text in pure ASCII or Unicode with Latin scripts, but things get tricky when we want to transfer non-Latin scripts (e.g. Japanese, Chinese, or any of the Cyrillic alphabets). (This is mostly caused by different Content-Transfer-Encoding being chosen by email.generator.)

BytesHeaderParser and its string counterpart let us only parse the headers and keep original message body in memory. The drawback is that we can't process multipart messages as sequences of MIME entities, which we need for one of the Lacre's modes of operation. (There are two: PGP/MIME with whole body encrypted and PGP/Inline with each part of multipart message encrypted separately.) We could use BytesHeaderParser with PGP/MIME only, because a multipart message would be impossible to handle in PGP/Inline mode.

Research: avoiding message transformation (part 2)

It turns out that we can avoid some of the transformations:

To achieve that, we'd need to adjust the flow and:

  1. Work with a plain Envelope initially to identify identities and prepare for encryption.
  2. We could use header-only parser mentioned above during delivery planning (lacre.core, function delivery_plan).
  3. Finally, if the message is known to be processed in PGP/Inline mode, we could load each MIME entity's body and process it. (Without ContentManager if possible.)