Skip to content

Commit

Permalink
Added additional PKCS#12 tests (#10622)
Browse files Browse the repository at this point in the history
  • Loading branch information
alex committed Mar 22, 2024
1 parent f9b78cf commit 8bd15a1
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/hazmat/primitives/test_pkcs12.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,33 @@ def test_generate_cas_friendly_names(self, backend):

p12_cert = load_pkcs12(p12, None, backend)
cas = p12_cert.additional_certs
assert cas[0].certificate == cert2
assert cas[0].friendly_name == b"cert2"
assert cas[1].certificate == cert3
assert cas[1].friendly_name is None

def test_generate_cas_friendly_names_no_key(self, backend):
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,
None,
[
PKCS12Certificate(cert2, b"cert2"),
PKCS12Certificate(cert3, None),
],
encryption,
)

p12_cert = load_pkcs12(p12, None, backend)
cas = p12_cert.additional_certs
assert cas[0].certificate == cert2
assert cas[0].friendly_name == b"cert2"
assert cas[1].certificate == cert3
assert cas[1].friendly_name is None

def test_generate_wrong_types(self, backend):
Expand Down

0 comments on commit 8bd15a1

Please sign in to comment.