當前位置: 首頁>>代碼示例>>Python>>正文


Python ExtensionOID.EXTENDED_KEY_USAGE屬性代碼示例

本文整理匯總了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 
開發者ID:aliyun,項目名稱:oss-ftp,代碼行數:19,代碼來源:backend.py

示例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) 
開發者ID:mathiasertl,項目名稱:django-ca,代碼行數:8,代碼來源:models.py

示例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)" 
開發者ID:mozilla,項目名稱:tls-canary,代碼行數:14,代碼來源:cert.py


注:本文中的cryptography.x509.oid.ExtensionOID.EXTENDED_KEY_USAGE屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。