diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_x509.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/test_x509.py b/tests/test_x509.py index 6145edb1..fde0755e 100644 --- a/tests/test_x509.py +++ b/tests/test_x509.py @@ -18,7 +18,7 @@ import pytest import six from cryptography import utils, x509 -from cryptography.exceptions import UnsupportedAlgorithm +from cryptography.exceptions import UnsupportedAlgorithm, InvalidSignature from cryptography.hazmat.backends.interfaces import ( DSABackend, EllipticCurveBackend, RSABackend, X509Backend ) @@ -1241,6 +1241,24 @@ class TestRSACertificateRequest(object): with pytest.raises(TypeError): request.public_bytes('NotAnEncoding') + def test_verify_bad(self, backend): + request = _load_cert( + os.path.join("x509", "requests", "invalid_signature.pem"), + x509.load_pem_x509_csr, + backend + ) + + with pytest.raises(InvalidSignature): + request.verify() + + def test_verify_good(self, backend): + request = _load_cert( + os.path.join("x509", "requests", "rsa_sha256.pem"), + x509.load_pem_x509_csr, + backend + ) + request.verify() + @pytest.mark.parametrize( ("request_path", "loader_func", "encoding"), [ |