예제 #1
0
파일: ca.py 프로젝트: LeadroyaL/drozer-py3
    def testItShouldNotCreateACertificateWithoutACA(self):
        ca = CA()

        try:
            ca.create_certificate()

            assert False, "expected NoKeyMaterialError"
        except NoKeyMaterialError:
            pass
        except:
            assert False, "expected NoKeyMaterialError"
예제 #2
0
파일: ca.py 프로젝트: LeadroyaL/drozer-py3
    def testItShouldCreateACertificate(self):
        ca = CA()
        ca.create_ca()

        key, certificate = ca.create_certificate()

        assert isinstance(key, OpenSSL.crypto.PKey)
        assert isinstance(certificate, OpenSSL.crypto.X509)
예제 #3
0
파일: ca.py 프로젝트: LeadroyaL/drozer-py3
    def testTheCertificateKeyMaterialShouldBeValid(self):
        ca = CA()
        ca.create_ca()

        key, certificate = ca.create_certificate()

        ctx = OpenSSL.SSL.Context(OpenSSL.SSL.TLSv1_METHOD)
        ctx.use_privatekey(key)
        ctx.use_certificate(certificate)

        try:
            ctx.check_privatekey()
        except OpenSSL.SSL.Error:
            assert False, "key does not match certificate"
        except:
            pass