def __init__(self): self.pkey = ezbakeca.private_key() req = ezbakeca.csr(self.pkey, CN="EzCA", O="Ezbake", OU="Ezbake Core", C="US") self.ca = ezbakeca.create_ca_certificate(req, self.pkey) self.appKey = ezbakeca.private_key() req = ezbakeca.csr(self.appKey, CN="APP") self.appCert = ezbakeca.create_certificate(req, (self.ca, self.pkey), 2)
def test_create_cert(self): pkey = ezbakeca.private_key() req = ezbakeca.csr(pkey, CN="App", O="Ezbake", OU="Ezbake Apps", C="US") cert = ezbakeca.create_certificate(req, (self.ca, self.pkey), 2) nt.assert_is_instance(cert, crypto.X509) nt.assert_equal(cert.get_subject(), req.get_subject()) nt.assert_equal(cert.get_issuer(), self.ca.get_subject()) nt.assert_equal(cert.get_serial_number(), 2) nt.assert_equal(cert.get_version(), 2)
def test_java_csr(self): csr = crypto.load_certificate_request(crypto.FILETYPE_PEM, JAVA_CSR) cert = ezbakeca.create_certificate(csr, (self.ca, self.pkey), 4) nt.assert_is_instance(cert, crypto.X509)