Skip to content

Commit 7c4bd87

Browse files
authored
Update protocol.py
1 parent 6271269 commit 7c4bd87

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/cyphersyntax/protocol.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,17 @@
33

44
PROTOCOL_VERSION = 1
55
MAX_MESSAGE_SEQUENCE = (1 << 64) - 1
6+
MAX_PROTOCOL_VERSION = (1 << 16) - 1
7+
MAX_PARTICIPANT_NAME_BYTES = 255
8+
MAX_SUITE_NAME_BYTES = 64
9+
MAX_PLAINTEXT_BYTES = 1_048_576
10+
AEAD_TAG_BYTES = 16
11+
MAX_CIPHERTEXT_BYTES = MAX_PLAINTEXT_BYTES + AEAD_TAG_BYTES
12+
MAX_ENVELOPE_BYTES = (MAX_CIPHERTEXT_BYTES * 2) + 4096
613

714

815
def validate_message_sequence(sequence: int) -> None:
9-
if isinstance(sequence, bool) or not isinstance(sequence, int):
16+
if type(sequence) is not int:
1017
raise TypeError("message sequence must be an integer")
1118
if not 0 <= sequence <= MAX_MESSAGE_SEQUENCE:
1219
raise ValueError("message sequence must fit in an unsigned 64-bit integer")

0 commit comments

Comments
 (0)