mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2026-10-27 16:02:05 +00:00
22 lines
647 B
Python
22 lines
647 B
Python
import logging
|
|
from pathlib import Path
|
|
|
|
from helpers import TEST_SEED
|
|
from utils.key_derivation import derive_index_key
|
|
from password_manager.encryption import EncryptionManager
|
|
|
|
|
|
def test_v2_prefix_fernet_fallback(tmp_path: Path, caplog) -> None:
|
|
key = derive_index_key(TEST_SEED)
|
|
manager = EncryptionManager(key, tmp_path)
|
|
|
|
original = b"legacy data"
|
|
token = manager.fernet.encrypt(original)
|
|
payload = b"V2:" + token
|
|
|
|
caplog.set_level(logging.WARNING, logger="password_manager.encryption")
|
|
decrypted = manager.decrypt_data(payload)
|
|
|
|
assert decrypted == original
|
|
assert "incorrect 'V2:' header" in caplog.text
|