]> www.wagner.pp.ru Git - oss/ctypescrypto.git/blob - ctypescrypto/x509.py
28c587c1673e879c6a5263cdc967695fe7dd5128
[oss/ctypescrypto.git] / ctypescrypto / x509.py
1 from ctypes import c_void_p
2 from ctypescrypto.bio import Membio
3 from ctypescrypto.exception import LibCryptoError
4 from crypescrypto import libcrypto
5
6 class X509Name:
7         def __init__(self,ptr):
8                 self.ptr=ptr
9         def __del__(self):
10                 libcrypto.X509_NAME_free(self.ptr)
11         def __str__(self):
12
13         def __len__(self):
14                 return libcrypto.X509_NAME_entry_count(self.ptr)
15
16         def __getattr__(self,key):
17           
18         def __setattr__(self,key,val):
19
20 class X509_extlist:
21         def __init__(self,ptr):
22                 self.ptr=ptr
23         def __del__(self):
24                 libcrypto.X509_NAME_free(self.ptr)
25         def __str__(self):
26
27         def __len__(self):
28                 return libcrypto.X509_NAME_entry_count(self.ptr)
29
30         def __getattr__(self,key):
31           
32         def __setattr__(self,key,val):
33
34
35         
36
37
38 class X509:
39         def __init__(self,ptr):
40                 self.cert = ptr
41         def __del__(self):
42                 libcrypto.X509_free(self.cert)
43         def __str__(self):
44                 """ Returns der string of the certificate """
45         def pubkey(self):
46                 """ Returns EVP PKEy object of certificate public key"""
47                 return PKey(libcrypto.X509_get_pubkey(self.cert,False)
48         def verify(self,key):   
49                 """ Verify self on given issuer key """
50         def frompem(s):
51                 """ Create X509 object from pem string """
52         def fromder(s):
53                 """ Create X509 object from der string """
54         def subject(self):
55                 return X509Name(libcrypto.X509_get_subject_name(self.cert))
56         def issuer(self):
57                 return X509Name(libcrypto.X509_get_issuer_name(self.cert))
58         def serial(self):
59                 return
60
61         def startDate(self):
62
63         def endDate(self);
64
65         def extensions(self):