Skip to content

Commit 2a3b8d7

Browse files
committed
fix: (tests/test_trad_crypto.py)
1 parent d33d0b6 commit 2a3b8d7

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tests/test_trad_crypto.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
decrypt_xchacha20poly1305,
1111
derive_key_argon2id
1212
)
13+
from core.constants import (
14+
ARGON2ID_OUTPUT_LEN,
15+
ARGON2_SALT_LEN,
16+
)
1317

1418

1519
def test_aes_encrypt_decrypt():
@@ -21,8 +25,12 @@ def test_aes_encrypt_decrypt():
2125
key, salt = derive_key_argon2id(password)
2226
assert key != salt, "Derived key should not equal derived salt"
2327
assert key != password, "Derived key should not match plaintext password"
28+
assert data != key, "Derived key should not match data"
29+
assert data != salt, "Derived salt should not match data"
30+
assert len(key) == ARGON2ID_OUTPUT_LEN, "key length does not match constant length"
31+
assert len(salt) == ARGON2ID_SALT_LEN, "salt length does not match constant length"
2432

25-
# Encrypt plaintext using AES-GCM
33+
# Encrypt plaintext using xChaCha20Poly1305
2634
nonce, ciphertext = encrypt_xchacha20poly1305(key, data)
2735
assert nonce != ciphertext, "Nonce and ciphertext should not be equal"
2836
assert ciphertext != data, "Ciphertext should differ from plaintext"

0 commit comments

Comments
 (0)