diff options
Diffstat (limited to 'src')
4 files changed, 57 insertions, 1 deletions
diff --git a/src/cryptography/hazmat/backends/interfaces.py b/src/cryptography/hazmat/backends/interfaces.py index f433afcb..8fc78309 100644 --- a/src/cryptography/hazmat/backends/interfaces.py +++ b/src/cryptography/hazmat/backends/interfaces.py @@ -250,3 +250,18 @@ class PKCS8SerializationBackend(object): Load a private key from PKCS8 encoded data, using password if the data is encrypted. """ + + +@six.add_metaclass(abc.ABCMeta) +class X509Backend(object): + @abc.abstractmethod + def load_pem_x509_certificate(self, data): + """ + Load an X.509 certificate from PEM encoded data. + """ + + @abc.abstractmethod + def load_der_x509_certificate(self, data): + """ + Load an X.509 certificate from DER encoded data. + """ diff --git a/src/cryptography/hazmat/bindings/commoncrypto/cf.py b/src/cryptography/hazmat/bindings/commoncrypto/cf.py index 6a6dbc4a..77d2d7cc 100644 --- a/src/cryptography/hazmat/bindings/commoncrypto/cf.py +++ b/src/cryptography/hazmat/bindings/commoncrypto/cf.py @@ -16,7 +16,7 @@ typedef uint32_t UInt32; typedef const void * CFAllocatorRef; const CFAllocatorRef kCFAllocatorDefault; -typedef const void * CFDataRef; +typedef ... *CFDataRef; typedef signed long long CFIndex; typedef ... *CFStringRef; typedef ... *CFArrayRef; diff --git a/src/cryptography/hazmat/bindings/commoncrypto/secimport.py b/src/cryptography/hazmat/bindings/commoncrypto/secimport.py index 7ee535d8..41a799f9 100644 --- a/src/cryptography/hazmat/bindings/commoncrypto/secimport.py +++ b/src/cryptography/hazmat/bindings/commoncrypto/secimport.py @@ -75,6 +75,8 @@ OSStatus SecItemImport(CFDataRef, CFStringRef, SecExternalFormat *, const SecItemImportExportKeyParameters *, SecKeychainRef, CFArrayRef *); OSStatus SecPKCS12Import(CFDataRef, CFDictionaryRef, CFArrayRef *); +OSStatus SecItemExport(CFTypeRef, SecExternalFormat, SecItemImportExportFlags, + const SecItemImportExportKeyParameters *, CFDataRef *); """ MACROS = """ diff --git a/src/cryptography/hazmat/primitives/interfaces.py b/src/cryptography/hazmat/primitives/interfaces.py index 7d9fc4fb..18a62601 100644 --- a/src/cryptography/hazmat/primitives/interfaces.py +++ b/src/cryptography/hazmat/primitives/interfaces.py @@ -488,3 +488,42 @@ class MACContext(object): # DeprecatedIn07 CMACContext = MACContext + + +@six.add_metaclass(abc.ABCMeta) +class X509Certificate(object): + @abc.abstractmethod + def fingerprint(self, algorithm): + """ + Returns bytes using digest passed. + """ + + @abc.abstractproperty + def serial(self): + """ + Returns certificate serial number + """ + + @abc.abstractproperty + def version(self): + """ + Returns the certificate version + """ + + @abc.abstractmethod + def public_key(self): + """ + Returns the public key + """ + + @abc.abstractproperty + def not_before(self): + """ + Not before time (represented as UTC datetime) + """ + + @abc.abstractproperty + def not_after(self): + """ + Not after time (represented as UTC datetime) + """ |