aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cryptography/hazmat/backends/interfaces.py15
-rw-r--r--src/cryptography/hazmat/primitives/interfaces.py39
2 files changed, 54 insertions, 0 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/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)
+ """