File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 1010 decrypt_xchacha20poly1305 ,
1111 derive_key_argon2id
1212)
13+ from core .constants import (
14+ ARGON2ID_OUTPUT_LEN ,
15+ ARGON2_SALT_LEN ,
16+ )
1317
1418
1519def 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"
You can’t perform that action at this time.
0 commit comments