本文整理匯總了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)