コード例 #1
0
 def test_invalid_signature(self):
     resp = OCSPResponse(resp_sig_sha1)
     cert = X509()
     cert.parseBinary(cert_sig_sha1)
     old_sig = resp.signature
     resp.signature = bytearray([0])
     self.assertNotEqual(resp.signature, old_sig)
     with self.assertRaises(ValueError) as ctx:
         resp.verify_signature(cert.publicKey)
     self.assertTrue("Signature could not be verified for sha1" in str(ctx.exception))
コード例 #2
0
 def test_invalid_signature(self):
     resp = OCSPResponse(resp_sig_sha1)
     cert = X509()
     cert.parseBinary(cert_sig_sha1)
     old_sig = resp.signature
     resp.signature = bytearray([0])
     self.assertNotEqual(resp.signature, old_sig)
     with self.assertRaises(ValueError) as ctx:
         resp.verify_signature(cert.publicKey)
     self.assertTrue(
         "Signature could not be verified for sha1" in str(ctx.exception))
コード例 #3
0
 def test_certs_signature(self):
     resp = OCSPResponse(resp_OK)
     self.assertGreater(len(resp.certs), 0)
     cert = resp.certs[0]  # checking only first certificate
     self.assertIsInstance(cert, X509)
     self.assertTrue(resp.verify_signature(resp.certs[0].publicKey))
コード例 #4
0
 def test_verify_signature_sha256(self):
     resp = OCSPResponse(resp_sig_sha256)
     cert = X509()
     cert.parseBinary(cert_sig_sha256)
     self.assertTrue(resp.verify_signature(cert.publicKey))
コード例 #5
0
 def test_certs_signature(self):
     resp = OCSPResponse(resp_OK)
     self.assertGreater(len(resp.certs), 0)
     cert = resp.certs[0]  # checking only first certificate
     self.assertIsInstance(cert, X509)
     self.assertTrue(resp.verify_signature(resp.certs[0].publicKey))
コード例 #6
0
 def test_verify_signature_sha256(self):
     resp = OCSPResponse(resp_sig_sha256)
     cert = X509()
     cert.parseBinary(cert_sig_sha256)
     self.assertTrue(resp.verify_signature(cert.publicKey))