]> wagner.pp.ru Git - oss/ctypescrypto.git/commitdiff
Removed x509 stuff from pkey.py and placed into separate file
authorVictor Wagner <vitus@wagner.pp.ru>
Wed, 4 Jun 2014 20:38:12 +0000 (00:38 +0400)
committerVictor Wagner <vitus@wagner.pp.ru>
Wed, 4 Jun 2014 20:38:12 +0000 (00:38 +0400)
ctypescrypto/pkey.py
ctypescrypto/x509.py [new file with mode: 0644]

index 63bdfd8bcd37866694d3fe99bd27eb403e0f7a36..d5e09ced0797d479dc18e40424c41a81baef86e1 100644 (file)
@@ -119,33 +119,3 @@ class PKey:
                libcrypto.EVP_PKEY_CTX_free(ctx)
                return PKey(key,True)
                        
-class X509:
-       def __init__(self,ptr):
-               self.cert = ptr
-       def __del__(self):
-               libcrypto.X509_free(self.cert)
-       def __str__(self):
-               """ Returns der string of the certificate """
-       def pubkey(self):
-               """ Returns EVP PKEy object of certificate public key"""
-               return PKey(libcrypto.X509_get_pubkey(self.cert,False)
-       def verify(self,key):   
-               """ Verify self on given issuer key """
-       def frompem(s):
-               """ Create X509 object from pem string """
-       def fromder(s):
-               """ Create X509 object from der string """
-
-class Verifier:
-       def __init__(self,filename):
-       
-       def verify_cert(self,cert):
-
-class Signer:
-       def __init__(self,key):
-               self.key = key
-       def sign(self,digest):
-               if not self.key.cansign:
-                       raise ValueError("Current PKey doesn't contain private part")
-       def verify(self,signature,digest):
-
diff --git a/ctypescrypto/x509.py b/ctypescrypto/x509.py
new file mode 100644 (file)
index 0000000..28c587c
--- /dev/null
@@ -0,0 +1,65 @@
+from ctypes import c_void_p
+from ctypescrypto.bio import Membio
+from ctypescrypto.exception import LibCryptoError
+from crypescrypto import libcrypto
+
+class X509Name:
+       def __init__(self,ptr):
+               self.ptr=ptr
+       def __del__(self):
+               libcrypto.X509_NAME_free(self.ptr)
+       def __str__(self):
+
+       def __len__(self):
+               return libcrypto.X509_NAME_entry_count(self.ptr)
+
+       def __getattr__(self,key):
+         
+       def __setattr__(self,key,val):
+
+class X509_extlist:
+       def __init__(self,ptr):
+               self.ptr=ptr
+       def __del__(self):
+               libcrypto.X509_NAME_free(self.ptr)
+       def __str__(self):
+
+       def __len__(self):
+               return libcrypto.X509_NAME_entry_count(self.ptr)
+
+       def __getattr__(self,key):
+         
+       def __setattr__(self,key,val):
+
+
+       
+
+
+class X509:
+       def __init__(self,ptr):
+               self.cert = ptr
+       def __del__(self):
+               libcrypto.X509_free(self.cert)
+       def __str__(self):
+               """ Returns der string of the certificate """
+       def pubkey(self):
+               """ Returns EVP PKEy object of certificate public key"""
+               return PKey(libcrypto.X509_get_pubkey(self.cert,False)
+       def verify(self,key):   
+               """ Verify self on given issuer key """
+       def frompem(s):
+               """ Create X509 object from pem string """
+       def fromder(s):
+               """ Create X509 object from der string """
+       def subject(self):
+               return X509Name(libcrypto.X509_get_subject_name(self.cert))
+       def issuer(self):
+               return X509Name(libcrypto.X509_get_issuer_name(self.cert))
+       def serial(self):
+               return
+
+       def startDate(self):
+
+       def endDate(self);
+
+       def extensions(self):