Title: signing needs two serialisation passes
Type: performance Stage: patch review
Components: email Versions: Python 3.8
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: barry, jap, r.david.murray
Priority: normal Keywords: patch

Created on 2019-12-24 15:24 by jap, last changed 2019-12-24 17:53 by r.david.murray.

Pull Requests
URL Status Linked Edit
PR 17695 open jap, 2019-12-24 15:25
Messages (2)
msg358849 - (view) Author: Jasper Spaans (jap) * Date: 2019-12-24 15:24
When creating multipart/signed messages, this currently require two serialisation passes: once to extract the flattened contents to be signed, and once to actually serialise the message.

The PR this ticket will be linked to contains a new class, MIMEMultipartSigned, which can be instantiated with a signer function that can perform the signing while serialising, reducing this to only once.

Besides, this ensures that the signed contents cannot changed between signing and outputting.

Patch is against py3.8
msg358851 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2019-12-24 17:53
Ideally this should be exposed by extending the content manager.  Instantiating MIME classes is part of the old API, not the new. The code in the PR may well be correct, but class should be hidden from the normal user (of the new API).  I'm not sure what the best way to specify the signing function will be, but I'm guessing a new keyword parameter in the content API.

Note that the current content management API is more of a framework than a fully worked out system, so figuring out the best way to add this may require some design discussion.
Date User Action Args
2019-12-24 17:53:24r.david.murraysetmessages: + msg358851
2019-12-24 15:25:51japsetkeywords: + patch
stage: patch review
pull_requests: + pull_request17149
2019-12-24 15:24:15japcreate