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


Python QSslSocket.setDefaultCiphers方法代码示例

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


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

示例1: init

# 需要导入模块: from PyQt5.QtNetwork import QSslSocket [as 别名]
# 或者: from PyQt5.QtNetwork.QSslSocket import setDefaultCiphers [as 别名]
def init():
    """Disable insecure SSL ciphers on old Qt versions."""
    if not qtutils.version_check("5.3.0"):
        # Disable weak SSL ciphers.
        # See https://codereview.qt-project.org/#/c/75943/
        good_ciphers = [c for c in QSslSocket.supportedCiphers() if c.usedBits() >= 128]
        QSslSocket.setDefaultCiphers(good_ciphers)
开发者ID:xu-fengfeng,项目名称:qutebrowser,代码行数:9,代码来源:networkmanager.py

示例2: init

# 需要导入模块: from PyQt5.QtNetwork import QSslSocket [as 别名]
# 或者: from PyQt5.QtNetwork.QSslSocket import setDefaultCiphers [as 别名]
def init():
    """Disable insecure SSL ciphers on old Qt versions."""
    default_ciphers = QSslSocket.defaultCiphers()
    log.init.debug("Default Qt ciphers: {}".format(
        ', '.join(c.name() for c in default_ciphers)))

    good_ciphers = []
    bad_ciphers = []
    for cipher in default_ciphers:
        if _is_secure_cipher(cipher):
            good_ciphers.append(cipher)
        else:
            bad_ciphers.append(cipher)

    log.init.debug("Disabling bad ciphers: {}".format(
        ', '.join(c.name() for c in bad_ciphers)))
    QSslSocket.setDefaultCiphers(good_ciphers)
开发者ID:The-Compiler,项目名称:qutebrowser,代码行数:19,代码来源:networkmanager.py

示例3: initSSL

# 需要导入模块: from PyQt5.QtNetwork import QSslSocket [as 别名]
# 或者: from PyQt5.QtNetwork.QSslSocket import setDefaultCiphers [as 别名]
def initSSL():
    """
    Function to initialize some global SSL stuff.
    """
    blacklist = [
        "SRP-AES-256-CBC-SHA",          # open to MitM
        "SRP-AES-128-CBC-SHA",          # open to MitM
    ]
    
    try:
        from PyQt5.QtNetwork import QSslSocket
    except ImportError:
        # no SSL available, so there is nothing to initialize
        return
    
    strongCiphers = [c for c in QSslSocket.supportedCiphers()
                     if c.name() not in blacklist and c.usedBits() >= 128]
    QSslSocket.setDefaultCiphers(strongCiphers)
开发者ID:testmana2,项目名称:test,代码行数:20,代码来源:E5SslUtilities.py

示例4: init

# 需要导入模块: from PyQt5.QtNetwork import QSslSocket [as 别名]
# 或者: from PyQt5.QtNetwork.QSslSocket import setDefaultCiphers [as 别名]
def init():
    """Disable insecure SSL ciphers on old Qt versions."""
    if qtutils.version_check("5.3.0"):
        default_ciphers = QSslSocket.defaultCiphers()
        log.init.debug("Default Qt ciphers: {}".format(", ".join(c.name() for c in default_ciphers)))
    else:
        # https://codereview.qt-project.org/#/c/75943/
        default_ciphers = QSslSocket.supportedCiphers()
        log.init.debug("Supported Qt ciphers: {}".format(", ".join(c.name() for c in default_ciphers)))

    good_ciphers = []
    bad_ciphers = []
    for cipher in default_ciphers:
        if _is_secure_cipher(cipher):
            good_ciphers.append(cipher)
        else:
            bad_ciphers.append(cipher)

    log.init.debug("Disabling bad ciphers: {}".format(", ".join(c.name() for c in bad_ciphers)))
    QSslSocket.setDefaultCiphers(good_ciphers)
开发者ID:rumpelsepp,项目名称:qutebrowser,代码行数:22,代码来源:networkmanager.py


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