11# tests/test_trad_crypto.py
22"""
3- Tests for AES-256 GCM encryption/ decryption and Argon2id key derivation.
4- Focus: Correctness of encryption/ decryption flow and tamper detection.
3+ Tests for XChaCha20Poly1305 encryption & decryption and Argon2id key derivation.
4+ Focus: Correctness of encryption & decryption flow and tamper detection.
55"""
66
77import pytest
88from core .trad_crypto import (
9- encrypt_aes_gcm ,
10- decrypt_aes_gcm ,
9+ encrypt_xchacha20poly1305 ,
10+ decrypt_xchacha20poly1305 ,
1111 derive_key_argon2id
1212)
1313
@@ -23,12 +23,12 @@ def test_aes_encrypt_decrypt():
2323 assert key != password , "Derived key should not match plaintext password"
2424
2525 # Encrypt plaintext using AES-GCM
26- nonce , ciphertext = encrypt_aes_gcm (key , data )
26+ nonce , ciphertext = encrypt_xchacha20poly1305 (key , data )
2727 assert nonce != ciphertext , "Nonce and ciphertext should not be equal"
2828 assert ciphertext != data , "Ciphertext should differ from plaintext"
2929
3030 # Decrypt ciphertext and verify correctness
31- plaintext = decrypt_aes_gcm (key , nonce , ciphertext )
31+ plaintext = decrypt_xchacha20poly1305 (key , nonce , ciphertext )
3232 assert plaintext == data , "Decrypted plaintext does not match original"
3333
3434 # Tampering test: Modify ciphertext and expect decryption failure
0 commit comments