2 Interface to OpenSSL object identifier database
4 from ctypescrypto import libcrypto
6 def __init__(self,value):
7 if type(value) == type(""):
8 self.nid=libcrypto.OBJ_txt2nid(value)
10 raise LibCryptoError("Cannot find object %s in the
12 elif type(value) == type(0):
15 raise TypeError("Cannot convert this type to object identifier")
16 def __cmp__(self,other):
17 return self.nid-other.nid
21 return libcrypto.OBJ_nid2sn(self.nid)
23 return libcrypto.OBJ_nid2ln(self.nid)
25 obj=libcrypto.OBJ_nid2obj(self.nid)
26 buf=create_string_buffer(256)
27 libcrypto.OBJ_obj2txt(buf,256,obj,1)