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)
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)
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)
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)
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')
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
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)