diff options
| author | Alex Gaynor <alex.gaynor@gmail.com> | 2021-10-24 16:57:53 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-25 04:57:53 +0800 |
| commit | 0c83be7a4440b6f6532f25f1217e233d5ef7d5f3 (patch) | |
| tree | 4e42f421c802fd5541a1e0a87af1c463323685f2 /tests | |
| parent | 380096f3bbd6916ee03096c03a4bb598782da197 (diff) | |
| download | cryptography-0c83be7a4440b6f6532f25f1217e233d5ef7d5f3.tar.gz | |
Added a test for signing an OCSP response with an unknown private key type (#6469)
* Added a test for signing an OCSP response with an unknown private key type
* Update test_ocsp.py
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/x509/test_ocsp.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/x509/test_ocsp.py b/tests/x509/test_ocsp.py index b2b2378dd..26e6606d1 100644 --- a/tests/x509/test_ocsp.py +++ b/tests/x509/test_ocsp.py @@ -805,6 +805,28 @@ class TestOCSPResponseBuilder(object): ocsp.OCSPResponseStatus.SUCCESSFUL ) + def test_sign_unknown_private_key(self, backend): + builder = ocsp.OCSPResponseBuilder() + cert, issuer = _cert_and_issuer() + root_cert, _ = _generate_root() + current_time = datetime.datetime.utcnow().replace(microsecond=0) + this_update = current_time - datetime.timedelta(days=1) + next_update = this_update + datetime.timedelta(days=7) + builder = builder.responder_id( + ocsp.OCSPResponderEncoding.NAME, root_cert + ).add_response( + cert, + issuer, + hashes.SHA1(), + ocsp.OCSPCertStatus.GOOD, + this_update, + next_update, + None, + None, + ) + with pytest.raises(TypeError): + builder.sign(object(), hashes.SHA256()) # type:ignore[arg-type] + @pytest.mark.supported( only_if=lambda backend: backend.hash_supported( hashes.BLAKE2b(digest_size=64) |
