forked from p15670423/monkey
Island: Create custom type EncryptionKey32Bit
This commit is contained in:
parent
cbe842029a
commit
d55e7b1455
|
@ -15,6 +15,22 @@ logger = logging.getLogger(__name__)
|
||||||
# Note: password != key
|
# Note: password != key
|
||||||
|
|
||||||
|
|
||||||
|
class SizeError(Exception):
|
||||||
|
"""
|
||||||
|
Raised when an argument is not of the expected size during object creation.
|
||||||
|
"""
|
||||||
|
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class EncryptionKey32Bit(bytes):
|
||||||
|
def __init__(self, key: bytes):
|
||||||
|
if len(key) == 32:
|
||||||
|
self.key = key
|
||||||
|
else:
|
||||||
|
raise SizeError("Key size should be 32 bytes.")
|
||||||
|
|
||||||
|
|
||||||
class KeyBasedEncryptor(IEncryptor):
|
class KeyBasedEncryptor(IEncryptor):
|
||||||
def __init__(self, key: bytes):
|
def __init__(self, key: bytes):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue