aboutsummaryrefslogtreecommitdiffstats
path: root/tests/x509
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2018-10-07 11:07:14 +0800
committerAlex Gaynor <alex.gaynor@gmail.com>2018-10-06 23:07:14 -0400
commit788b859efd679b5df90475b32eeccf593d7eb38e (patch)
treee953592c88179747452dbcd848185129442fe360 /tests/x509
parent0c07580a216d4b75bfdca22254803cf48c602079 (diff)
downloadcryptography-788b859efd679b5df90475b32eeccf593d7eb38e.tar.gz
cryptography-788b859efd679b5df90475b32eeccf593d7eb38e.tar.bz2
cryptography-788b859efd679b5df90475b32eeccf593d7eb38e.zip
OCSP response serialization (#4482)
* support OCSP response serialization * empty commit, good times
Diffstat (limited to 'tests/x509')
-rw-r--r--tests/x509/test_ocsp.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/x509/test_ocsp.py b/tests/x509/test_ocsp.py
index d680e07f..0d44b6da 100644
--- a/tests/x509/test_ocsp.py
+++ b/tests/x509/test_ocsp.py
@@ -330,3 +330,22 @@ class TestOCSPResponse(object):
assert ext.value == x509.OCSPNonce(
b'\x04\x105\x957\x9fa\x03\x83\x87\x89rW\x8f\xae\x99\xf7"'
)
+
+ def test_serialize_reponse(self):
+ resp_bytes = load_vectors_from_file(
+ filename=os.path.join("x509", "ocsp", "resp-revoked.der"),
+ loader=lambda data: data.read(),
+ mode="rb"
+ )
+ resp = ocsp.load_der_ocsp_response(resp_bytes)
+ assert resp.public_bytes(serialization.Encoding.DER) == resp_bytes
+
+ def test_invalid_serialize_encoding(self):
+ resp = _load_data(
+ os.path.join("x509", "ocsp", "resp-revoked.der"),
+ ocsp.load_der_ocsp_response,
+ )
+ with pytest.raises(ValueError):
+ resp.public_bytes("invalid")
+ with pytest.raises(ValueError):
+ resp.public_bytes(serialization.Encoding.PEM)