From 08a3280b062af83ee50fa139d7827d954907886e Mon Sep 17 00:00:00 2001 From: Simeon Simeonov Date: Mon, 13 May 2024 21:52:13 +0200 Subject: Implement re-encryption support --- tests/conftest.py | 61 +++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 55 insertions(+), 6 deletions(-) (limited to 'tests/conftest.py') diff --git a/tests/conftest.py b/tests/conftest.py index cbf7152..37dd184 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -45,9 +45,9 @@ def config_data(): 'ETOOLKIT_SENSITIVE': ['ETOOLKIT_TEST_PASSWORD'], 'GNUPGHOME': '%h/private/.gnupg', 'ETOOLKIT_TEST_PASSWORD': ( - 'enc-val$2$v6F2M7LeUDbQWNLg6WW5mUcbuYYo7aGynSxzWAENVBI=$' - 'ZcyWzf9Kp0aYI8N+biKMSmu4RGGi199ayq' - 'EYdJl+qdq7b1HSutwYlC7UR2GsSofu4Xo=' + 'enc-val$2$RCSZqq9pWrRDoCVYVHopyu1LzaJGfv8roVviqrLTBxM=$' + '+YYrZbwTBuG0Pl+WMQrvxLUtq5j8qYuQqz' + 'oIwgoGt7AaWZCJz+E7qoDeg3wke70ST8U=' ), }, }, @@ -63,12 +63,35 @@ def config_file(tmp_path, config_data): return str(cf) +@pytest.fixture() +def long_encrypted_value(): + """enc. value corresponding to 'Nobody expects the Spanish inquisition'""" + + return ( + 'enc-val$2$uYpZM1VfAGq0CDZL2duITs076CQj+hIFEgx+F4mn80o=$' + 'UWP5YeRsh5/2vZ2J1UOS+BJti73Kbp6C1pJmCo8hF' + 'Sujpe35X/XpzBegJJpo86AiCsNsUS6B6JM=' + ) + + +@pytest.fixture() +def long_value(): + """standard value (> 32 bytes)""" + return 'Nobody expects the Spanish inquisition' + + @pytest.fixture() def master_password(): """Master passord""" return 'The very secret passwd' +@pytest.fixture() +def new_master_password(): + """Master passord""" + return 'New very secret passwd' + + @pytest.fixture() def non_random_bytes_32(): """always use the same bytes instead of os.urandom(32)""" @@ -80,13 +103,13 @@ def non_random_bytes_32(): @pytest.fixture() -def non_random_bytes_61(): - """always use the same bytes instead of os.urandom(61)""" +def non_random_bytes_57(): + """always use the same bytes instead of os.urandom(57)""" return ( b'D$\x99\xaa\xafiZ\xb4C\xa0%XTz)\xca\xedK\xcd\xa2F~\xff+\xa1[\xe2\xaa' b'\xb2\xd3\x07\x13\xedb\xc2\x84\xfe\tS\r\xf0\x02_\xef\xe3\xde\xf1?e' - b'\xa4s(Q\x04\xcd\xc7T\x01_D\xb1' + b'\xa4s(Q\x04\xcd\xc7T' ) @@ -107,6 +130,32 @@ def password_hash(): ) +@pytest.fixture() +def short_encrypted_value(): + """enc. value corresponding to 'secret1'""" + + return ( + 'enc-val$2$RCSZqq9pWrRDoCVYVHopyu1LzaJGfv8roVviqrLTBxM=$' + '+YYrZbwTBuG0Pl+WMQrvxLUtq5j8qYuQqzoIwgoGt7AaWZCJz+E7qoDeg3wke70ST8U=' + ) + + +@pytest.fixture() +def short_encrypted_value_v1(): + """enc. value (enc-val 1) corresponding to 'secret1'""" + + return ( + 'enc-val$1$/cXpEMoZrTlb9yokGhw8tLTSUkqnqJ4ZoAkurNgMYx' + 'w=$1VdkSMcZnLRwLiu1M8VlYcbelwmiVNY=' + ) + + +@pytest.fixture() +def short_value(): + """standard value (< 32 bytes)""" + return 'secret1' + + @pytest.fixture() def wrong_master_password(): """Wrong master passord""" -- cgit v1.3