diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2016-03-12 12:44:24 -0400 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2016-03-12 12:44:24 -0400 |
commit | 83457cf270fef19446d7bead3b0eb86f6d04c4f5 (patch) | |
tree | a707488be039cfdf8b2b384e153b971688f0d49a /tests/hazmat/backends/test_openssl.py | |
parent | ab973321f6012626e63420603c34e2975f42f237 (diff) | |
download | cryptography-83457cf270fef19446d7bead3b0eb86f6d04c4f5.tar.gz cryptography-83457cf270fef19446d7bead3b0eb86f6d04c4f5.tar.bz2 cryptography-83457cf270fef19446d7bead3b0eb86f6d04c4f5.zip |
move NUMERICSTRING certificate test to test_openssl & make it more specific
Diffstat (limited to 'tests/hazmat/backends/test_openssl.py')
-rw-r--r-- | tests/hazmat/backends/test_openssl.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/hazmat/backends/test_openssl.py b/tests/hazmat/backends/test_openssl.py index 072f8be3..b9db3071 100644 --- a/tests/hazmat/backends/test_openssl.py +++ b/tests/hazmat/backends/test_openssl.py @@ -31,6 +31,7 @@ from ..primitives.test_ec import _skip_curve_unsupported from ...doubles import ( DummyAsymmetricPadding, DummyCipherAlgorithm, DummyHashAlgorithm, DummyMode ) +from ...test_x509 import _load_cert from ...utils import load_vectors_from_file, raises_unsupported_algorithm @@ -656,3 +657,23 @@ class TestRSAPEMSerialization(object): serialization.PrivateFormat.PKCS8, serialization.BestAvailableEncryption(password) ) + + +class TestGOSTCertificate(object): + @pytest.mark.skipif( + backend._lib.OPENSSL_VERSION_NUMBER < 0x1000000f, + reason="Requires a newer OpenSSL. Must be >= 1.0.0" + ) + def test_numeric_string_x509_name_entry(self): + cert = _load_cert( + os.path.join("x509", "e-trust.ru.der"), + x509.load_der_x509_certificate, + backend + ) + with pytest.raises(ValueError) as exc: + cert.subject + + # We assert on the message in this case because if the certificate + # fails to load it will also raise a ValueError and this test could + # erroneously pass. + assert exc.value.message == "Unsupported ASN1 string type. Type: 18" |