def test_x5c_decoding(self): from acme.jose.jws import Header header = Header(x5c=(CERT, CERT)) jobj = header.to_partial_json() cert_b64 = base64.b64encode(CERT.as_der()) self.assertEqual(jobj, {'x5c': [cert_b64, cert_b64]}) self.assertEqual(header, Header.from_json(jobj)) jobj['x5c'][0] = base64.b64encode('xxx' + CERT.as_der()) self.assertRaises(errors.DeserializationError, Header.from_json, jobj)
def test_x5c_decoding(self): from acme.jose.jws import Header header = Header(x5c=(CERT, CERT)) jobj = header.to_partial_json() cert_asn1 = OpenSSL.crypto.dump_certificate( OpenSSL.crypto.FILETYPE_ASN1, CERT.wrapped) cert_b64 = base64.b64encode(cert_asn1) self.assertEqual(jobj, {'x5c': [cert_b64, cert_b64]}) self.assertEqual(header, Header.from_json(jobj)) jobj['x5c'][0] = base64.b64encode(b'xxx' + cert_asn1) self.assertRaises(errors.DeserializationError, Header.from_json, jobj)
def test_x5c_decoding(self): from acme.jose.jws import Header header = Header(x5c=(CERT, CERT)) jobj = header.to_partial_json() cert_asn1 = OpenSSL.crypto.dump_certificate(OpenSSL.crypto.FILETYPE_ASN1, CERT.wrapped) cert_b64 = base64.b64encode(cert_asn1) self.assertEqual(jobj, {"x5c": [cert_b64, cert_b64]}) self.assertEqual(header, Header.from_json(jobj)) jobj["x5c"][0] = base64.b64encode(b"xxx" + cert_asn1) self.assertRaises(errors.DeserializationError, Header.from_json, jobj)