Exemplo n.º 1
0
def load_certificate_request(csr, datatype=PEM):
    """
    Given a base64-encoded certificate request, with or without the
    header/footer, return a request object.
    """
    if datatype == PEM:
        csr = strip_header(csr)
        csr = base64.b64decode(csr)

    # A fail-safe so we can always read a CSR. python-nss/NSS will segfault
    # otherwise
    if not nss.nss_is_initialized():
        nss.nss_init_nodb()

    return nss.CertificateRequest(csr)
Exemplo n.º 2
0
 def setUp(self):
     nss.nss_init_nodb()
     self.csr_der = nss.SecItem(pem, ascii=True)
     self.csr = nss.CertificateRequest(self.csr_der)