本文整理汇总了Python中cryptography.x509.oid.ExtensionOID.EXTENDED_KEY_USAGE属性的典型用法代码示例。如果您正苦于以下问题:Python ExtensionOID.EXTENDED_KEY_USAGE属性的具体用法?Python ExtensionOID.EXTENDED_KEY_USAGE怎么用?Python ExtensionOID.EXTENDED_KEY_USAGE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类cryptography.x509.oid.ExtensionOID
的用法示例。
在下文中一共展示了ExtensionOID.EXTENDED_KEY_USAGE属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _encode_extended_key_usage
# 需要导入模块: from cryptography.x509.oid import ExtensionOID [as 别名]
# 或者: from cryptography.x509.oid.ExtensionOID import EXTENDED_KEY_USAGE [as 别名]
def _encode_extended_key_usage(backend, extended_key_usage):
eku = backend._lib.sk_ASN1_OBJECT_new_null()
eku = backend._ffi.gc(eku, backend._lib.sk_ASN1_OBJECT_free)
for oid in extended_key_usage:
obj = _txt2obj(backend, oid.dotted_string)
res = backend._lib.sk_ASN1_OBJECT_push(eku, obj)
backend.openssl_assert(res >= 1)
pp = backend._ffi.new('unsigned char **')
r = backend._lib.i2d_EXTENDED_KEY_USAGE(
backend._ffi.cast("EXTENDED_KEY_USAGE *", eku), pp
)
backend.openssl_assert(r > 0)
pp = backend._ffi.gc(
pp, lambda pointer: backend._lib.OPENSSL_free(pointer[0])
)
return pp, r
示例2: extended_key_usage
# 需要导入模块: from cryptography.x509.oid import ExtensionOID [as 别名]
# 或者: from cryptography.x509.oid.ExtensionOID import EXTENDED_KEY_USAGE [as 别名]
def extended_key_usage(self):
"""The :py:class:`~django_ca.extensions.ExtendedKeyUsage` extension, or ``None`` if it doesn't
exist."""
ext = self.get_x509_extension(ExtensionOID.EXTENDED_KEY_USAGE)
if ext is not None:
return ExtendedKeyUsage(ext)
示例3: ext_key_usage
# 需要导入模块: from cryptography.x509.oid import ExtensionOID [as 别名]
# 或者: from cryptography.x509.oid.ExtensionOID import EXTENDED_KEY_USAGE [as 别名]
def ext_key_usage(self):
"""
Extract certificate's permitted extended usages
:return: str
"""
try:
usages = self.x509.extensions.get_extension_for_oid(ExtensionOID.EXTENDED_KEY_USAGE).value
usages_strings = [usage._name for usage in usages]
return ",".join(usages_strings)
except x509.ExtensionNotFound:
return "(no ext key usage)"