Exemplo n.º 1
0
    def test_ca_status_forbidden(self):
        csr = x509_csr.X509Csr()
        ext = x509_ext.X509ExtensionBasicConstraints()
        ext.set_ca(True)
        csr.add_extension(ext)

        with self.assertRaises(errors.ValidationError) as e:
            internal.ca_status(csr=csr)
        self.assertEqual("Request is for a CA certificate", str(e.exception))
Exemplo n.º 2
0
    def test_ca_status_key_usage_bad2(self):
        csr = x509_csr.X509Csr()
        ext = x509_ext.X509ExtensionKeyUsage()
        ext.set_usage('cRLSign', True)
        csr.add_extension(ext)

        with self.assertRaises(errors.ValidationError) as e:
            internal.ca_status(csr=csr)
        self.assertEqual("Request contains CRL signing usage flag",
                         str(e.exception))
Exemplo n.º 3
0
    def test_ca_status_forbidden(self):
        csr = x509_csr.X509Csr()
        ext = x509_ext.X509ExtensionBasicConstraints()
        ext.set_ca(True)
        csr.add_extension(ext)

        with self.assertRaises(errors.ValidationError) as e:
            internal.ca_status(csr=csr)
        self.assertEqual("Request is for a CA certificate",
                         str(e.exception))
Exemplo n.º 4
0
    def test_ca_status_key_usage_bad2(self):
        csr = x509_csr.X509Csr()
        ext = x509_ext.X509ExtensionKeyUsage()
        ext.set_usage('cRLSign', True)
        csr.add_extension(ext)

        with self.assertRaises(errors.ValidationError) as e:
            internal.ca_status(csr=csr)
        self.assertEqual("Request contains CRL signing usage flag",
                         str(e.exception))
Exemplo n.º 5
0
    def test_ca_status_pathlen(self):
        csr = x509_csr.X509Csr()
        ext = x509_ext.X509ExtensionBasicConstraints()
        ext.set_path_len_constraint(1)
        csr.add_extension(ext)

        self.assertIsNone(internal.ca_status(csr=csr))
Exemplo n.º 6
0
    def test_ca_status_good(self):
        csr = x509_csr.X509Csr()
        ext = x509_ext.X509ExtensionBasicConstraints()
        ext.set_ca(False)
        csr.add_extension(ext)

        self.assertIsNone(internal.ca_status(csr=csr))
Exemplo n.º 7
0
    def test_ca_status_pathlen(self):
        csr = x509_csr.X509Csr()
        ext = x509_ext.X509ExtensionBasicConstraints()
        ext.set_path_len_constraint(1)
        csr.add_extension(ext)

        self.assertIsNone(internal.ca_status(csr=csr))
Exemplo n.º 8
0
    def test_ca_status_good(self):
        csr = x509_csr.X509Csr()
        ext = x509_ext.X509ExtensionBasicConstraints()
        ext.set_ca(False)
        csr.add_extension(ext)

        self.assertIsNone(internal.ca_status(csr=csr))