Refactored cyphertext to ciphertext for consistency

This commit is contained in:
VakarisZ 2021-06-11 11:43:15 +03:00
parent 5cf002d81a
commit 3450b80a82
4 changed files with 10 additions and 10 deletions

View File

@ -27,9 +27,9 @@ def encrypt_config(config: Dict, password: str) -> str:
return ciphertext_b64.decode()
def decrypt_config(cyphertext: str, password: str) -> Dict:
cyphertext = base64.b64decode(cyphertext)
ciphertext_config_stream = io.BytesIO(cyphertext)
def decrypt_config(ciphertext: str, password: str) -> Dict:
ciphertext = base64.b64decode(ciphertext)
ciphertext_config_stream = io.BytesIO(ciphertext)
dec_plaintext_config_stream = io.BytesIO()
len_ciphertext_config_stream = len(ciphertext_config_stream.getvalue())

View File

@ -1,8 +1,8 @@
import json
import pytest
from tests.unit_tests.monkey_island.cc.services.utils.cyphertexts_for_encryption_test import (
MALFORMED_CYPHER_TEXT_CORRUPTED,
from tests.unit_tests.monkey_island.cc.services.utils.ciphertexts_for_encryption_test import (
MALFORMED_CIPHER_TEXT_CORRUPTED,
)
from tests.unit_tests.monkey_island.cc.services.utils.test_config_encryption import PASSWORD
@ -23,7 +23,7 @@ def test_is_config_encrypted__ciphertext(monkey_config):
def test_is_config_encrypted__corrupt_ciphertext():
with pytest.raises(InvalidConfigurationError):
assert ConfigurationImport.is_config_encrypted(MALFORMED_CYPHER_TEXT_CORRUPTED)
assert ConfigurationImport.is_config_encrypted(MALFORMED_CIPHER_TEXT_CORRUPTED)
def test_is_config_encrypted__unknown_format():

View File

@ -1,4 +1,4 @@
MALFORMED_CYPHER_TEXT_CORRUPTED = (
MALFORMED_CIPHER_TEXT_CORRUPTED = (
"QUVTAgAAGM0NKEYTESTURfQlkAcHlBZXNDcnlwdCA2LjAuMACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEWlHUF5GTDFdrlGaUbFqGOBHE"

View File

@ -1,6 +1,6 @@
import pytest
from tests.unit_tests.monkey_island.cc.services.utils.cyphertexts_for_encryption_test import (
MALFORMED_CYPHER_TEXT_CORRUPTED,
from tests.unit_tests.monkey_island.cc.services.utils.ciphertexts_for_encryption_test import (
MALFORMED_CIPHER_TEXT_CORRUPTED,
)
from monkey_island.cc.services.utils.config_encryption import (
@ -28,7 +28,7 @@ def test_encrypt_decrypt_config__wrong_password(monkey_config):
def test_encrypt_decrypt_config__malformed_corrupted():
with pytest.raises(ValueError):
decrypt_config(MALFORMED_CYPHER_TEXT_CORRUPTED, PASSWORD)
decrypt_config(MALFORMED_CIPHER_TEXT_CORRUPTED, PASSWORD)
def test_encrypt_decrypt_config__decrypt_no_password(monkey_config):