Allow SKESK packets in encrypted mails

They are not used by Delta Chat now,
but this will allow to start using them in the future.
This commit is contained in:
link2xt
2024-06-13 16:56:57 +00:00
committed by holger krekel
parent c8d270a853
commit 2b5d903cc5
2 changed files with 8 additions and 5 deletions

View File

@@ -2,8 +2,9 @@
## untagged ## untagged
- check that OpenPGP has only PKESK and SEIPD packets - check that OpenPGP has only PKESK, SKESK and SEIPD packets
([#323](https://github.com/deltachat/chatmail/pull/323)) ([#323](https://github.com/deltachat/chatmail/pull/323),
[#324](https://github.com/deltachat/chatmail/pull/324))
- improve filtermail checks for encrypted messages and drop support for unencrypted MDNs - improve filtermail checks for encrypted messages and drop support for unencrypted MDNs
([#320](https://github.com/deltachat/chatmail/pull/320)) ([#320](https://github.com/deltachat/chatmail/pull/320))

View File

@@ -18,7 +18,7 @@ from .config import read_config
def check_openpgp_payload(payload: bytes): def check_openpgp_payload(payload: bytes):
"""Checks the OpenPGP payload. """Checks the OpenPGP payload.
OpenPGP payload must consist only of PKESK packets OpenPGP payload must consist only of PKESK and SKESK packets
terminated by a single SEIPD packet. terminated by a single SEIPD packet.
Returns True if OpenPGP payload is correct, Returns True if OpenPGP payload is correct,
@@ -63,9 +63,11 @@ def check_openpgp_payload(payload: bytes):
# Last packet should be # Last packet should be
# Symmetrically Encrypted and Integrity Protected Data Packet (SEIPD) # Symmetrically Encrypted and Integrity Protected Data Packet (SEIPD)
return True return True
elif packet_type_id != 1: elif packet_type_id not in [1, 3]:
# All packets except the last one must be # All packets except the last one must be either
# Public-Key Encrypted Session Key Packet (PKESK) # Public-Key Encrypted Session Key Packet (PKESK)
# or
# Symmetric-Key Encrypted Session Key Packet (SKESK)
return False return False
if i > len(payload): if i > len(payload):