當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。