diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2024-03-21 22:44:41 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-22 02:44:41 +0000 |
commit | 089039d0f6bb34d6a8b4dcdb04265547abc74c1d (patch) | |
tree | 9dee49650085f0fc3cf6fd42cf9b6a5a8de0d6f9 /tests | |
parent | 8bd15a1d28c78b48791e68aa6800271fd11abf8b (diff) | |
download | pyca-cryptography-089039d0f6bb34d6a8b4dcdb04265547abc74c1d.zip pyca-cryptography-089039d0f6bb34d6a8b4dcdb04265547abc74c1d.tar.gz pyca-cryptography-089039d0f6bb34d6a8b4dcdb04265547abc74c1d.tar.bz2 |
Added additional PKCS#12 tests (#10625)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/hazmat/primitives/test_pkcs12.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/hazmat/primitives/test_pkcs12.py b/tests/hazmat/primitives/test_pkcs12.py index f5284b7..9217e4e 100644 --- a/tests/hazmat/primitives/test_pkcs12.py +++ b/tests/hazmat/primitives/test_pkcs12.py @@ -529,6 +529,30 @@ class TestPKCS12Creation: assert parsed_key is None assert parsed_more_certs == [cert] + def test_generate_cert_only_none_cas(self, backend): + # Same as test_generate_cert_only, but passing None instead of an + # empty list for cas. + cert, _ = _load_ca(backend) + p12 = serialize_key_and_certificates( + None, None, cert, None, serialization.NoEncryption() + ) + parsed_key, parsed_cert, parsed_more_certs = load_key_and_certificates( + p12, None + ) + assert parsed_cert is None + assert parsed_key is None + assert parsed_more_certs == [cert] + + def test_invalid_utf8_friendly_name(self, backend): + if rust_openssl.CRYPTOGRAPHY_IS_LIBRESSL: + pytest.skip("Temporarily doesn't work on LibreSSL") + + cert, _ = _load_ca(backend) + with pytest.raises(ValueError): + serialize_key_and_certificates( + b"\xc9", None, cert, None, serialization.NoEncryption() + ) + def test_must_supply_something(self): with pytest.raises(ValueError) as exc: serialize_key_and_certificates( |