本文整理汇总了Python中cryptography.x509.InhibitAnyPolicy方法的典型用法代码示例。如果您正苦于以下问题:Python x509.InhibitAnyPolicy方法的具体用法?Python x509.InhibitAnyPolicy怎么用?Python x509.InhibitAnyPolicy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cryptography.x509
的用法示例。
在下文中一共展示了x509.InhibitAnyPolicy方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _decode_inhibit_any_policy
# 需要导入模块: from cryptography import x509 [as 别名]
# 或者: from cryptography.x509 import InhibitAnyPolicy [as 别名]
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) }
示例2: _decode_inhibit_any_policy
# 需要导入模块: from cryptography import x509 [as 别名]
# 或者: from cryptography.x509 import InhibitAnyPolicy [as 别名]
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)
示例3: _decode_inhibit_any_policy
# 需要导入模块: from cryptography import x509 [as 别名]
# 或者: from cryptography.x509 import InhibitAnyPolicy [as 别名]
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)
示例4: extension_type
# 需要导入模块: from cryptography import x509 [as 别名]
# 或者: from cryptography.x509 import InhibitAnyPolicy [as 别名]
def extension_type(self):
return x509.InhibitAnyPolicy(skip_certs=self.value)
示例5: test_int
# 需要导入模块: from cryptography import x509 [as 别名]
# 或者: from cryptography.x509 import InhibitAnyPolicy [as 别名]
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})
示例6: test_no_int
# 需要导入模块: from cryptography import x509 [as 别名]
# 或者: from cryptography.x509 import InhibitAnyPolicy [as 别名]
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')
示例7: test_skip_certs
# 需要导入模块: from cryptography import x509 [as 别名]
# 或者: from cryptography.x509 import InhibitAnyPolicy [as 别名]
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)