mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2026-10-31 09:52:03 +00:00
tests: use AES-GCM key generation
This commit is contained in:
1 parent
f4a169ca80
commit
f7c2017f1c
9 files changed
+31
-20
No files matched your search
@@ -3,7 +3,8 @@ import sys
|
||||
from pathlib import Path
|
||||
from tempfile import TemporaryDirectory
|
||||
|
||||
from cryptography.fernet import Fernet
|
||||
import os
|
||||
import base64
|
||||
|
||||
sys.path.append(str(Path(__file__).resolve().parents[1]))
|
||||
|
||||
@@ -12,7 +13,7 @@ from password_manager.encryption import EncryptionManager
|
||||
|
||||
def test_json_save_and_load_round_trip():
|
||||
with TemporaryDirectory() as tmpdir:
|
||||
key = Fernet.generate_key()
|
||||
key = base64.urlsafe_b64encode(os.urandom(32))
|
||||
manager = EncryptionManager(key, Path(tmpdir))
|
||||
|
||||
data = {"hello": "world", "nums": [1, 2, 3]}
|
||||
@@ -27,7 +28,7 @@ def test_json_save_and_load_round_trip():
|
||||
|
||||
def test_encrypt_and_decrypt_file_binary_round_trip():
|
||||
with TemporaryDirectory() as tmpdir:
|
||||
key = Fernet.generate_key()
|
||||
key = base64.urlsafe_b64encode(os.urandom(32))
|
||||
manager = EncryptionManager(key, Path(tmpdir))
|
||||
|
||||
payload = b"binary secret"
|
||||
|
||||
Reference in new issue
Block a user