Exemplo n.º 1
0
 def create_from_pem(self, pem, path=None):
     """
     Create appropriate certificate object from a PEM string.
     """
     if not pem:
         raise CertificateException("Empty certificate")
     return self._read_x509(_certificate.load(pem=pem), path, pem)
Exemplo n.º 2
0
 def create_from_pem(self, pem, path=None):
     """
     Create appropriate certificate object from a PEM string.
     """
     if not pem:
         raise CertificateException("Empty certificate")
     return self._read_x509(_certificate.load(pem=pem), path)
Exemplo n.º 3
0
 def create_from_file(self, path):
     """
     Create appropriate certificate object from a PEM file on disk.
     """
     try:
         pem = open(path, 'r').read()
     except IOError as err:
         raise CertificateException("Error loading certificate: %s" % err)
     return self._read_x509(_certificate.load(path), path, pem)
Exemplo n.º 4
0
 def create_from_file(self, path):
     """
     Create appropriate certificate object from a PEM file on disk.
     """
     try:
         pem = open(path, 'r').read()
     except IOError as err:
         raise CertificateException("Error loading certificate: %s" % err)
     return self._read_x509(_certificate.load(path), path, pem)
Exemplo n.º 5
0
 def create_from_file(self, path):
     """
     Create appropriate certificate object from a PEM file on disk.
     """
     try:
         pem = open(path, 'r').read()
     except IOError as e:
         print(os.strerror(e.errno))
         exit(1)
     return self._read_x509(_certificate.load(path), path, pem)
Exemplo n.º 6
0
 def create_from_file(self, path):
     """
     Create appropriate certificate object from a PEM file on disk.
     """
     try:
         pem = open(path, 'r').read()
     except IOError as e:
         print(os.strerror(e.errno))
         exit(1)
     return self._read_x509(_certificate.load(path), path, pem)
Exemplo n.º 7
0
    def _update(self, content):
        if content:
            x509 = _certificate.load(pem=content)
            if x509 is None:
                raise CertificateException("Error loading certificate")
        else:
            x509 = _certificate.X509()
        self.__ext = Extensions(x509)
        self.x509 = x509

        self.subj = self.x509.get_subject()
        self.serial = self.x509.get_serial_number()

        self.altName = x509.get_extension(name='subjectAltName')
Exemplo n.º 8
0
    def _update(self, content):
        if content:
            x509 = _certificate.load(pem=content)
            if x509 is None:
                raise CertificateException("Error loading certificate")
        else:
            x509 = _certificate.X509()
        self.__ext = Extensions(x509)
        self.x509 = x509

        self.subj = self.x509.get_subject()
        self.serial = self.x509.get_serial_number()

        self.altName = x509.get_extension(name='subjectAltName')
Exemplo n.º 9
0
 def create_from_file(self, path):
     """
     Create appropriate certificate object from a PEM file on disk.
     """
     return self._read_x509(_certificate.load(path), path)
 def _get_subject_key_id(self, pem):
     cert = _certificate.load(pem=pem)
     subject_key_id = cert.get_extension(oid="2.5.29.14")
     return subject_key_id
Exemplo n.º 11
0
 def _get_subject_key_id(self, pem):
     cert = _certificate.load(pem=pem)
     subject_key_id = cert.get_extension(oid="2.5.29.14")
     return subject_key_id
Exemplo n.º 12
0
 def create_from_file(self, path):
     """
     Create appropriate certificate object from a PEM file on disk.
     """
     pem = open(path, 'r').read()
     return self._read_x509(_certificate.load(path), path, pem)