From 9654e869a7b76fe0fc94710c869a1850d0cadff7 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Tue, 19 Jul 2022 09:40:19 -0400 Subject: [PATCH] Island: Modify error messages in EncryptionKey32Bytes --- .../cc/server_utils/encryption/encryption_key_types.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/monkey/monkey_island/cc/server_utils/encryption/encryption_key_types.py b/monkey/monkey_island/cc/server_utils/encryption/encryption_key_types.py index 65872ca5a..c99065ceb 100644 --- a/monkey/monkey_island/cc/server_utils/encryption/encryption_key_types.py +++ b/monkey/monkey_island/cc/server_utils/encryption/encryption_key_types.py @@ -1,8 +1,9 @@ class EncryptionKey32Bytes(bytes): def __init__(self, key: bytes): if not isinstance(key, bytes): - raise TypeError("Key is not of type `bytes`") + raise TypeError("'key' must be of type 'bytes'") + if len(key) == 32: self.key = key else: - raise ValueError("Key size should be 32 bytes") + raise ValueError("'key' must be exactly 32 bytes")