当前位置: 首页>>代码示例>>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;未经允许,请勿转载。