aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cryptography/hazmat/backends/openssl/x509.py4
-rw-r--r--src/cryptography/x509.py42
2 files changed, 44 insertions, 2 deletions
diff --git a/src/cryptography/hazmat/backends/openssl/x509.py b/src/cryptography/hazmat/backends/openssl/x509.py
index 532785ac..35313b25 100644
--- a/src/cryptography/hazmat/backends/openssl/x509.py
+++ b/src/cryptography/hazmat/backends/openssl/x509.py
@@ -16,10 +16,10 @@ from __future__ import absolute_import, division, print_function
import datetime
from cryptography import utils, x509
-from cryptography.hazmat.primitives import hashes, interfaces
+from cryptography.hazmat.primitives import hashes
-@utils.register_interface(interfaces.X509Certificate)
+@utils.register_interface(x509.X509Certificate)
class _X509Certificate(object):
def __init__(self, backend, x509):
self._backend = backend
diff --git a/src/cryptography/x509.py b/src/cryptography/x509.py
index 191666e6..ed754cbc 100644
--- a/src/cryptography/x509.py
+++ b/src/cryptography/x509.py
@@ -4,8 +4,11 @@
from __future__ import absolute_import, division, print_function
+import abc
from enum import Enum
+import six
+
class X509Version(Enum):
v1 = 0
@@ -22,3 +25,42 @@ def load_der_x509_certificate(data, backend):
class InvalidX509Version(Exception):
pass
+
+
+@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_valid_before(self):
+ """
+ Not before time (represented as UTC datetime)
+ """
+
+ @abc.abstractproperty
+ def not_valid_after(self):
+ """
+ Not after time (represented as UTC datetime)
+ """