Python cryptography.x509.InhibitAnyPolicy() Examples

The following are 13 code examples of cryptography.x509.InhibitAnyPolicy(). 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: decode_asn1.py    From Safejumper-for-Desktop with GNU General Public License v2.0 6 votes vote down vote up
def _decode_inhibit_any_policy(backend, asn1_int):
    asn1_int = backend._ffi.cast("ASN1_INTEGER *", asn1_int)
    asn1_int = backend._ffi.gc(asn1_int, backend._lib.ASN1_INTEGER_free)
    skip_certs = _asn1_integer_to_int(backend, asn1_int)
    return x509.InhibitAnyPolicy(skip_certs)


#    CRLReason ::= ENUMERATED {
#        unspecified             (0),
#        keyCompromise           (1),
#        cACompromise            (2),
#        affiliationChanged      (3),
#        superseded              (4),
#        cessationOfOperation    (5),
#        certificateHold         (6),
#             -- value 7 is not used
#        removeFromCRL           (8),
#        privilegeWithdrawn      (9),
#        aACompromise           (10) } 
Example #2
Source File: x509.py    From oss-ftp with MIT License 5 votes vote down vote up
def _decode_inhibit_any_policy(backend, asn1_int):
    asn1_int = backend._ffi.cast("ASN1_INTEGER *", asn1_int)
    asn1_int = backend._ffi.gc(asn1_int, backend._lib.ASN1_INTEGER_free)
    skip_certs = backend._asn1_integer_to_int(asn1_int)
    return x509.InhibitAnyPolicy(skip_certs) 
Example #3
Source File: decode_asn1.py    From teleport with Apache License 2.0 5 votes vote down vote up
def _decode_inhibit_any_policy(backend, asn1_int):
    asn1_int = backend._ffi.cast("ASN1_INTEGER *", asn1_int)
    asn1_int = backend._ffi.gc(asn1_int, backend._lib.ASN1_INTEGER_free)
    skip_certs = _asn1_integer_to_int(backend, asn1_int)
    return x509.InhibitAnyPolicy(skip_certs) 
Example #4
Source File: decode_asn1.py    From teleport with Apache License 2.0 5 votes vote down vote up
def _decode_inhibit_any_policy(backend, asn1_int):
    asn1_int = backend._ffi.cast("ASN1_INTEGER *", asn1_int)
    asn1_int = backend._ffi.gc(asn1_int, backend._lib.ASN1_INTEGER_free)
    skip_certs = _asn1_integer_to_int(backend, asn1_int)
    return x509.InhibitAnyPolicy(skip_certs) 
Example #5
Source File: decode_asn1.py    From teleport with Apache License 2.0 5 votes vote down vote up
def _decode_inhibit_any_policy(backend, asn1_int):
    asn1_int = backend._ffi.cast("ASN1_INTEGER *", asn1_int)
    asn1_int = backend._ffi.gc(asn1_int, backend._lib.ASN1_INTEGER_free)
    skip_certs = _asn1_integer_to_int(backend, asn1_int)
    return x509.InhibitAnyPolicy(skip_certs) 
Example #6
Source File: decode_asn1.py    From learn_python3_spider with MIT License 5 votes vote down vote up
def _decode_inhibit_any_policy(backend, asn1_int):
    asn1_int = backend._ffi.cast("ASN1_INTEGER *", asn1_int)
    asn1_int = backend._ffi.gc(asn1_int, backend._lib.ASN1_INTEGER_free)
    skip_certs = _asn1_integer_to_int(backend, asn1_int)
    return x509.InhibitAnyPolicy(skip_certs) 
Example #7
Source File: extensions.py    From django-ca with GNU General Public License v3.0 5 votes vote down vote up
def extension_type(self):
        return x509.InhibitAnyPolicy(skip_certs=self.value) 
Example #8
Source File: tests_extensions.py    From django-ca with GNU General Public License v3.0 5 votes vote down vote up
def test_int(self):
        ext = InhibitAnyPolicy(0)
        self.assertEqual(ext.value, 0)
        ext = InhibitAnyPolicy(1)
        self.assertEqual(ext.value, 1)

        with self.assertRaisesRegex(ValueError, r'-1: must be a positive int$'):
            InhibitAnyPolicy(-1)
        with self.assertRaisesRegex(ValueError, r'-1: must be a positive int$'):
            InhibitAnyPolicy({'value': -1}) 
Example #9
Source File: tests_extensions.py    From django-ca with GNU General Public License v3.0 5 votes vote down vote up
def test_no_int(self):
        with self.assertRaisesRegex(ValueError, r'^None: must be an int$'):
            InhibitAnyPolicy(None)
        with self.assertRaisesRegex(ValueError, r'^abc: must be an int$'):
            InhibitAnyPolicy({'value': 'abc'})
        with self.assertRaisesRegex(ValueError, r'^Value is of unsupported type str$'):
            InhibitAnyPolicy('abc') 
Example #10
Source File: tests_extensions.py    From django-ca with GNU General Public License v3.0 5 votes vote down vote up
def test_skip_certs(self):
        ext = InhibitAnyPolicy(0)
        self.assertEqual(ext.skip_certs, 0)
        ext.skip_certs = 3
        self.assertEqual(ext.skip_certs, 3)

        with self.assertRaisesRegex(ValueError, r'^abc: must be an int$'):
            ext.skip_certs = 'abc'
        self.assertEqual(ext.skip_certs, 3)
        with self.assertRaisesRegex(ValueError, r'-1: must be a positive int$'):
            ext.skip_certs = -1
        self.assertEqual(ext.skip_certs, 3) 
Example #11
Source File: decode_asn1.py    From quickstart-git2s3 with Apache License 2.0 5 votes vote down vote up
def _decode_inhibit_any_policy(backend, asn1_int):
    asn1_int = backend._ffi.cast("ASN1_INTEGER *", asn1_int)
    asn1_int = backend._ffi.gc(asn1_int, backend._lib.ASN1_INTEGER_free)
    skip_certs = _asn1_integer_to_int(backend, asn1_int)
    return x509.InhibitAnyPolicy(skip_certs) 
Example #12
Source File: decode_asn1.py    From quickstart-redhat-openshift with Apache License 2.0 5 votes vote down vote up
def _decode_inhibit_any_policy(backend, asn1_int):
    asn1_int = backend._ffi.cast("ASN1_INTEGER *", asn1_int)
    asn1_int = backend._ffi.gc(asn1_int, backend._lib.ASN1_INTEGER_free)
    skip_certs = _asn1_integer_to_int(backend, asn1_int)
    return x509.InhibitAnyPolicy(skip_certs) 
Example #13
Source File: decode_asn1.py    From Carnets with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def _decode_inhibit_any_policy(backend, asn1_int):
    asn1_int = backend._ffi.cast("ASN1_INTEGER *", asn1_int)
    asn1_int = backend._ffi.gc(asn1_int, backend._lib.ASN1_INTEGER_free)
    skip_certs = _asn1_integer_to_int(backend, asn1_int)
    return x509.InhibitAnyPolicy(skip_certs)