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