# -*- coding: utf-8 -*-
"""The NOOP certificate module

Copyright © 2015-2015, Anders Andersen, The Arctic University of Norway.
See http://www.cs.uit.no/~aa/dist/tools/noop/COPYING (../COPYING) for
details.

"""


# Import system modules
import sys, os


# Python 3 only!
assert (sys.version_info[0] > 2 and sys.version_info[1] > 3), \
       "This NOOP module \"%s\" is Python 3.4 (or greater) only!" % (__name__,)


# Import modules
from cryptography import x509


# Load noop libraries (if available)
try:
    from noop.core.signature import signature, one, opt
    from noop.crypto.crypto import Key
except ImportError:
    def signature(f): return f
    class one:
        def __init__(*args): pass
    opt = one
    from crypto import Key


def _loadcertificate(pem:bytes) -> x509.Certificate:
    return x509.load_pem_x509_certificate(pem, default_backend())


class Cert(Key):
    pass