1 parent 6271269 commit 7c4bd87Copy full SHA for 7c4bd87
1 file changed
src/cyphersyntax/protocol.py
@@ -3,10 +3,17 @@
3
4
PROTOCOL_VERSION = 1
5
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
13
14
15
def validate_message_sequence(sequence: int) -> None:
- if isinstance(sequence, bool) or not isinstance(sequence, int):
16
+ if type(sequence) is not int:
17
raise TypeError("message sequence must be an integer")
18
if not 0 <= sequence <= MAX_MESSAGE_SEQUENCE:
19
raise ValueError("message sequence must fit in an unsigned 64-bit integer")
0 commit comments