Python cryptography.x509.PolicyConstraints() Examples
The following are 12
code examples of cryptography.x509.PolicyConstraints().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
cryptography.x509
, or try the search function
.
Example #1
Source File: tests_extensions.py From django-ca with GNU General Public License v3.0 | 6 votes |
def test_properties(self): p = PolicyConstraints() self.assertIsNone(p.inhibit_policy_mapping) self.assertIsNone(p.require_explicit_policy) p = PolicyConstraints({'value': {'inhibit_policy_mapping': 1, 'require_explicit_policy': 2}}) self.assertEqual(p.inhibit_policy_mapping, 1) self.assertEqual(p.require_explicit_policy, 2) p.inhibit_policy_mapping = 3 p.require_explicit_policy = 4 self.assertEqual(p.inhibit_policy_mapping, 3) self.assertEqual(p.require_explicit_policy, 4) p.inhibit_policy_mapping = None p.require_explicit_policy = None self.assertIsNone(p.inhibit_policy_mapping) self.assertIsNone(p.require_explicit_policy)
Example #2
Source File: tests_extensions.py From django-ca with GNU General Public License v3.0 | 6 votes |
def test_property_errors(self): p = PolicyConstraints({'value': {'inhibit_policy_mapping': 1, 'require_explicit_policy': 2}}) self.assertEqual(p.inhibit_policy_mapping, 1) self.assertEqual(p.require_explicit_policy, 2) with self.assertRaisesRegex(ValueError, r'^abc: inhibit_policy_mapping must be int or None$'): p.inhibit_policy_mapping = 'abc' with self.assertRaisesRegex(ValueError, r'^def: require_explicit_policy must be int or None$'): p.require_explicit_policy = 'def' self.assertEqual(p.inhibit_policy_mapping, 1) self.assertEqual(p.require_explicit_policy, 2) with self.assertRaisesRegex(ValueError, r'^-1: inhibit_policy_mapping must be a positive int$'): p.inhibit_policy_mapping = -1 with self.assertRaisesRegex(ValueError, r'^-1: require_explicit_policy must be a positive int$'): p.require_explicit_policy = -1 self.assertEqual(p.inhibit_policy_mapping, 1) self.assertEqual(p.require_explicit_policy, 2)
Example #3
Source File: decode_asn1.py From Safejumper-for-Desktop with GNU General Public License v2.0 | 5 votes |
def _decode_policy_constraints(backend, pc): pc = backend._ffi.cast("POLICY_CONSTRAINTS *", pc) pc = backend._ffi.gc(pc, backend._lib.POLICY_CONSTRAINTS_free) require_explicit_policy = _asn1_integer_to_int_or_none( backend, pc.requireExplicitPolicy ) inhibit_policy_mapping = _asn1_integer_to_int_or_none( backend, pc.inhibitPolicyMapping ) return x509.PolicyConstraints( require_explicit_policy, inhibit_policy_mapping )
Example #4
Source File: decode_asn1.py From teleport with Apache License 2.0 | 5 votes |
def _decode_policy_constraints(backend, pc): pc = backend._ffi.cast("POLICY_CONSTRAINTS *", pc) pc = backend._ffi.gc(pc, backend._lib.POLICY_CONSTRAINTS_free) require_explicit_policy = _asn1_integer_to_int_or_none( backend, pc.requireExplicitPolicy ) inhibit_policy_mapping = _asn1_integer_to_int_or_none( backend, pc.inhibitPolicyMapping ) return x509.PolicyConstraints( require_explicit_policy, inhibit_policy_mapping )
Example #5
Source File: decode_asn1.py From teleport with Apache License 2.0 | 5 votes |
def _decode_policy_constraints(backend, pc): pc = backend._ffi.cast("POLICY_CONSTRAINTS *", pc) pc = backend._ffi.gc(pc, backend._lib.POLICY_CONSTRAINTS_free) require_explicit_policy = _asn1_integer_to_int_or_none( backend, pc.requireExplicitPolicy ) inhibit_policy_mapping = _asn1_integer_to_int_or_none( backend, pc.inhibitPolicyMapping ) return x509.PolicyConstraints( require_explicit_policy, inhibit_policy_mapping )
Example #6
Source File: decode_asn1.py From teleport with Apache License 2.0 | 5 votes |
def _decode_policy_constraints(backend, pc): pc = backend._ffi.cast("POLICY_CONSTRAINTS *", pc) pc = backend._ffi.gc(pc, backend._lib.POLICY_CONSTRAINTS_free) require_explicit_policy = _asn1_integer_to_int_or_none( backend, pc.requireExplicitPolicy ) inhibit_policy_mapping = _asn1_integer_to_int_or_none( backend, pc.inhibitPolicyMapping ) return x509.PolicyConstraints( require_explicit_policy, inhibit_policy_mapping )
Example #7
Source File: decode_asn1.py From learn_python3_spider with MIT License | 5 votes |
def _decode_policy_constraints(backend, pc): pc = backend._ffi.cast("POLICY_CONSTRAINTS *", pc) pc = backend._ffi.gc(pc, backend._lib.POLICY_CONSTRAINTS_free) require_explicit_policy = _asn1_integer_to_int_or_none( backend, pc.requireExplicitPolicy ) inhibit_policy_mapping = _asn1_integer_to_int_or_none( backend, pc.inhibitPolicyMapping ) return x509.PolicyConstraints( require_explicit_policy, inhibit_policy_mapping )
Example #8
Source File: extensions.py From django-ca with GNU General Public License v3.0 | 5 votes |
def extension_type(self): return x509.PolicyConstraints(require_explicit_policy=self.value['require_explicit_policy'], inhibit_policy_mapping=self.value['inhibit_policy_mapping'])
Example #9
Source File: tests_extensions.py From django-ca with GNU General Public License v3.0 | 5 votes |
def test_init_error(self): with self.assertRaisesRegex(ValueError, r'^abc: inhibit_policy_mapping must be int or None$'): PolicyConstraints({'value': {'inhibit_policy_mapping': 'abc'}}) with self.assertRaisesRegex(ValueError, r'^-1: inhibit_policy_mapping must be a positive int$'): PolicyConstraints({'value': {'inhibit_policy_mapping': -1}}) with self.assertRaisesRegex(ValueError, r'^abc: require_explicit_policy must be int or None$'): PolicyConstraints({'value': {'require_explicit_policy': 'abc'}}) with self.assertRaisesRegex(ValueError, r'^-1: require_explicit_policy must be a positive int$'): PolicyConstraints({'value': {'require_explicit_policy': -1}})
Example #10
Source File: decode_asn1.py From quickstart-git2s3 with Apache License 2.0 | 5 votes |
def _decode_policy_constraints(backend, pc): pc = backend._ffi.cast("POLICY_CONSTRAINTS *", pc) pc = backend._ffi.gc(pc, backend._lib.POLICY_CONSTRAINTS_free) require_explicit_policy = _asn1_integer_to_int_or_none( backend, pc.requireExplicitPolicy ) inhibit_policy_mapping = _asn1_integer_to_int_or_none( backend, pc.inhibitPolicyMapping ) return x509.PolicyConstraints( require_explicit_policy, inhibit_policy_mapping )
Example #11
Source File: decode_asn1.py From quickstart-redhat-openshift with Apache License 2.0 | 5 votes |
def _decode_policy_constraints(backend, pc): pc = backend._ffi.cast("POLICY_CONSTRAINTS *", pc) pc = backend._ffi.gc(pc, backend._lib.POLICY_CONSTRAINTS_free) require_explicit_policy = _asn1_integer_to_int_or_none( backend, pc.requireExplicitPolicy ) inhibit_policy_mapping = _asn1_integer_to_int_or_none( backend, pc.inhibitPolicyMapping ) return x509.PolicyConstraints( require_explicit_policy, inhibit_policy_mapping )
Example #12
Source File: decode_asn1.py From Carnets with BSD 3-Clause "New" or "Revised" License | 5 votes |
def _decode_policy_constraints(backend, pc): pc = backend._ffi.cast("POLICY_CONSTRAINTS *", pc) pc = backend._ffi.gc(pc, backend._lib.POLICY_CONSTRAINTS_free) require_explicit_policy = _asn1_integer_to_int_or_none( backend, pc.requireExplicitPolicy ) inhibit_policy_mapping = _asn1_integer_to_int_or_none( backend, pc.inhibitPolicyMapping ) return x509.PolicyConstraints( require_explicit_policy, inhibit_policy_mapping )