当前位置: 首页>>代码示例>>Python>>正文


Python extensions.Extensions方法代码示例

本文整理汇总了Python中cryptography.x509.extensions.Extensions方法的典型用法代码示例。如果您正苦于以下问题:Python extensions.Extensions方法的具体用法?Python extensions.Extensions怎么用?Python extensions.Extensions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cryptography.x509.extensions的用法示例。


在下文中一共展示了extensions.Extensions方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _validate_dependencies_met

# 需要导入模块: from cryptography.x509 import extensions [as 别名]
# 或者: from cryptography.x509.extensions import Extensions [as 别名]
def _validate_dependencies_met():
    """
    Verifies that PyOpenSSL's package-level dependencies have been met.
    Throws `ImportError` if they are not met.
    """
    # Method added in `cryptography==1.1`; not available in older versions
    from cryptography.x509.extensions import Extensions
    if getattr(Extensions, "get_extension_for_class", None) is None:
        raise ImportError("'cryptography' module missing required functionality.  "
                          "Try upgrading to v1.3.4 or newer.")

    # pyOpenSSL 0.14 and above use cryptography for OpenSSL bindings. The _x509
    # attribute is only present on those versions.
    from OpenSSL.crypto import X509
    x509 = X509()
    if getattr(x509, "_x509", None) is None:
        raise ImportError("'pyOpenSSL' module missing required functionality. "
                          "Try upgrading to v0.14 or newer.") 
开发者ID:danielecook,项目名称:gist-alfred,代码行数:20,代码来源:pyopenssl.py

示例2: _validate_dependencies_met

# 需要导入模块: from cryptography.x509 import extensions [as 别名]
# 或者: from cryptography.x509.extensions import Extensions [as 别名]
def _validate_dependencies_met():
    """
    Verifies that PyOpenSSL's package-level dependencies have been met.
    Throws `ImportError` if they are not met.
    """
    # Method added in `cryptography==1.1`; not available in older versions
    from cryptography.x509.extensions import Extensions

    if getattr(Extensions, "get_extension_for_class", None) is None:
        raise ImportError(
            "'cryptography' module missing required functionality.  "
            "Try upgrading to v1.3.4 or newer."
        )

    # pyOpenSSL 0.14 and above use cryptography for OpenSSL bindings. The _x509
    # attribute is only present on those versions.
    from OpenSSL.crypto import X509

    x509 = X509()
    if getattr(x509, "_x509", None) is None:
        raise ImportError(
            "'pyOpenSSL' module missing required functionality. "
            "Try upgrading to v0.14 or newer."
        ) 
开发者ID:remg427,项目名称:misp42splunk,代码行数:26,代码来源:pyopenssl.py


注:本文中的cryptography.x509.extensions.Extensions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。