diff --git a/monkey/monkey_island/cc/server_utils/encryption/__init__.py b/monkey/monkey_island/cc/server_utils/encryption/__init__.py index 7fa6c77a4..a6671afb6 100644 --- a/monkey/monkey_island/cc/server_utils/encryption/__init__.py +++ b/monkey/monkey_island/cc/server_utils/encryption/__init__.py @@ -2,10 +2,6 @@ from .i_encryptor import IEncryptor from .key_based_encryptor import ( KeyBasedEncryptor, ) -from .password_based_string_encryptor import ( - PasswordBasedStringEncryptor, - is_encrypted, -) from .password_based_bytes_encryptor import ( PasswordBasedBytesEncryptor, InvalidCredentialsError, diff --git a/monkey/monkey_island/cc/server_utils/encryption/password_based_string_encryptor.py b/monkey/monkey_island/cc/server_utils/encryption/password_based_string_encryptor.py deleted file mode 100644 index dac7276e9..000000000 --- a/monkey/monkey_island/cc/server_utils/encryption/password_based_string_encryptor.py +++ /dev/null @@ -1,33 +0,0 @@ -import base64 -import logging - -import pyAesCrypt - -from .i_encryptor import IEncryptor -from .password_based_bytes_encryptor import PasswordBasedBytesEncryptor - -logger = logging.getLogger(__name__) - - -class PasswordBasedStringEncryptor(IEncryptor): - - _BUFFER_SIZE = pyAesCrypt.crypto.bufferSizeDef - - def __init__(self, password: str): - self.password = password - - def encrypt(self, plaintext: str) -> str: - ciphertext = PasswordBasedBytesEncryptor(self.password).encrypt(plaintext.encode()) - - return base64.b64encode(ciphertext).decode() - - def decrypt(self, ciphertext: str) -> str: - ciphertext = base64.b64decode(ciphertext) - - plaintext_stream = PasswordBasedBytesEncryptor(self.password).decrypt(ciphertext) - return plaintext_stream.decode() - - -def is_encrypted(ciphertext: str) -> bool: - ciphertext = base64.b64decode(ciphertext) - return ciphertext.startswith(b"AES")