def testItShouldLoadACA(self): old_ca = CA() old_ca.create_ca() key_pem = CA.pkey_to_pem(old_ca.ca_key) cert_pem = CA.certificate_to_pem(old_ca.ca_cert) ca = CA() assert ca.load(key_pem, cert_pem)
def testItShouldHaveACAAfterLoading(self): old_ca = CA() old_ca.create_ca() key_pem = CA.pkey_to_pem(old_ca.ca_key) cert_pem = CA.certificate_to_pem(old_ca.ca_cert) ca = CA() ca.load(key_pem, cert_pem) assert ca.has_ca()
def testItShouldNotLoadACAFromInvalidKeyMaterial(self): old_ca = CA() old_ca.create_ca() key_pem = CA.pkey_to_pem(old_ca.ca_key) old_ca.create_ca() cert_pem = CA.certificate_to_pem(old_ca.ca_cert) ca = CA() assert not ca.load(key_pem, cert_pem) assert not ca.has_ca()
def testItShouldSerializeACertificateToPEM(self): ca = CA() ca.create_ca() assert CA.certificate_to_pem(ca.ca_cert).find(b"CERTIFICATE") >= 0