forked from p15670423/monkey
Refactored cyphertext to ciphertext for consistency
This commit is contained in:
parent
5cf002d81a
commit
3450b80a82
|
@ -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())
|
||||
|
|
|
@ -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():
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
MALFORMED_CYPHER_TEXT_CORRUPTED = (
|
||||
MALFORMED_CIPHER_TEXT_CORRUPTED = (
|
||||
"QUVTAgAAGM0NKEYTESTURfQlkAcHlBZXNDcnlwdCA2LjAuMACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
|
||||
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
|
||||
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEWlHUF5GTDFdrlGaUbFqGOBHE"
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue