From e4e7b89fb627b372cde4158ceb7078d8769497cb Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Thu, 29 Nov 2018 11:51:38 +0800 Subject: PKCS12 Basic Parsing (#4553) * PKCS12 parsing support * running all the tests is so gauche * rename func * various significant fixes * dangerous idiot here * move pkcs12 * docs updates * a bit more prose --- tests/hazmat/backends/test_openssl_memleak.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests/hazmat/backends/test_openssl_memleak.py') diff --git a/tests/hazmat/backends/test_openssl_memleak.py b/tests/hazmat/backends/test_openssl_memleak.py index 483387af..6f42ed79 100644 --- a/tests/hazmat/backends/test_openssl_memleak.py +++ b/tests/hazmat/backends/test_openssl_memleak.py @@ -307,3 +307,21 @@ class TestOpenSSLMemoryLeaks(object): ).add_extension(x509.OCSPNonce(b"0000"), False) req = builder.build() """)) + + @pytest.mark.parametrize("path", [ + "pkcs12/cert-aes256cbc-no-key.p12", + "pkcs12/cert-key-aes256cbc.p12", + ]) + def test_load_pkcs12_key_and_certificates(self, path): + assert_no_memory_leaks(textwrap.dedent(""" + def func(path): + from cryptography import x509 + from cryptography.hazmat.backends.openssl import backend + from cryptography.hazmat.primitives.serialization import pkcs12 + import cryptography_vectors + + with cryptography_vectors.open_vector_file(path, "rb") as f: + pkcs12.load_key_and_certificates( + f.read(), b"cryptography", backend + ) + """), [path]) -- cgit v1.2.3