raise ValueError("Attempt to modify constant X509 object")
else:
raise NotImplementedError
+ def __hash__(self):
+ return libcrypto.X509_NAME_hash(self.ptr)
class _x509_ext(Structure):
""" Represens C structure X509_EXTENSION """
libcrypto.X509_dup.restype=c_void_p
libcrypto.sk_new_null.restype=c_void_p
libcrypto.X509_dup.argtypes=(c_void_p,)
+libcrypto.X509_NAME_hash.restype=c_long
+libcrypto.X509_NAME_hash.argtypes=(c_void_p,)
def test_notAfter(self):
c=X509(self.cert1)
self.assertEqual(c.endDate,datetime.datetime(2024,10,23,19,7,17,0,utc))
+ def test_subjectHash(self):
+ c=X509(self.cert1)
+ self.assertEqual(hash(c.subject),0x1f3ed722)
+ def test_issuerHash(self):
+ c=X509(self.cert1)
+ self.assertEqual(hash(c.issuer),0x7d3ea8c3)
def test_namecomp(self):
c=X509(self.cert1)
ca=X509(self.ca_cert)