aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2024-04-29 11:04:56 -0400
committerGitHub <noreply@github.com>2024-04-29 08:04:56 -0700
commitd5a3984a9a4f80d547a18ff06180864ff39ab9b5 (patch)
treef927893c13ca576dbfb9afbd5499d018e4f7c004 /tests
parent13fbef6d520f728660d63cc039be745333b24574 (diff)
downloadpyca-cryptography-d5a3984a9a4f80d547a18ff06180864ff39ab9b5.zip
pyca-cryptography-d5a3984a9a4f80d547a18ff06180864ff39ab9b5.tar.gz
pyca-cryptography-d5a3984a9a4f80d547a18ff06180864ff39ab9b5.tar.bz2
Added additional PKCS#12 tests (#10902)
Diffstat (limited to 'tests')
-rw-r--r--tests/hazmat/primitives/test_pkcs12.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/tests/hazmat/primitives/test_pkcs12.py b/tests/hazmat/primitives/test_pkcs12.py
index 3230718..5b97121 100644
--- a/tests/hazmat/primitives/test_pkcs12.py
+++ b/tests/hazmat/primitives/test_pkcs12.py
@@ -419,12 +419,20 @@ class TestPKCS12Creation:
assert cas[1].certificate == cert3
assert cas[1].friendly_name is None
- def test_generate_cas_friendly_names_no_key(self, backend):
+ @pytest.mark.parametrize(
+ ("encryption_algorithm", "password"),
+ [
+ (serialization.BestAvailableEncryption(b"password"), b"password"),
+ (serialization.NoEncryption(), None),
+ ],
+ )
+ def test_generate_cas_friendly_names_no_key(
+ self, backend, encryption_algorithm, password
+ ):
cert2 = _load_cert(
backend, os.path.join("x509", "custom", "dsa_selfsigned_ca.pem")
)
cert3 = _load_cert(backend, os.path.join("x509", "letsencryptx3.pem"))
- encryption = serialization.NoEncryption()
p12 = serialize_key_and_certificates(
None,
None,
@@ -433,10 +441,10 @@ class TestPKCS12Creation:
PKCS12Certificate(cert2, b"cert2"),
PKCS12Certificate(cert3, None),
],
- encryption,
+ encryption_algorithm,
)
- p12_cert = load_pkcs12(p12, None, backend)
+ p12_cert = load_pkcs12(p12, password, backend)
cas = p12_cert.additional_certs
assert cas[0].certificate == cert2
assert cas[0].friendly_name == b"cert2"