def test_extensions_bad(self): csr = x509_csr.X509Csr() ext = x509_ext.X509ExtensionKeyUsage() ext.set_usage('keyCertSign', True) csr.add_extension(ext) with self.assertRaises(errors.ValidationError) as e: custom.extensions( csr=csr, allowed_extensions=['basicConstraints', 'nameConstraints']) self.assertEqual("Extension 'keyUsage' not allowed", str(e.exception))
def test_extensions_good_oid(self): csr = x509_csr.X509Csr() ext = x509_ext.X509ExtensionKeyUsage() ext.set_usage('keyCertSign', True) csr.add_extension(ext) self.assertEqual( None, custom.extensions( csr=csr, allowed_extensions=['basicConstraints', '2.5.29.15']))
def test_extensions_good_oid(self): csr = x509_csr.X509Csr() ext = x509_ext.X509ExtensionKeyUsage() ext.set_usage('keyCertSign', True) csr.add_extension(ext) self.assertEqual( None, custom.extensions( csr=csr, allowed_extensions=['basicConstraints', '2.5.29.15'] ) )