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

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