当前位置: 首页 > news >正文

python3.11SSL: SSLV3_ALERT_HANDSHAKE_FAILURE

参考:python request包 版本不兼容 报错sslv3 alert handshake failure 解决方法-CSDN博客

修改:Python311\Lib\site-packages\urllib3\util\ssl_.py

新版本3.11里默认没有DEFAULT_CIPHERS

补回来:

#__imported from 3.6.8
# A secure default.
# Sources for more information on TLS ciphers:
#
# - https://wiki.mozilla.org/Security/Server_Side_TLS
# - https://www.ssllabs.com/projects/best-practices/index.html
# - https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/
#
# The general intent is:
# - prefer cipher suites that offer perfect forward secrecy (DHE/ECDHE),
# - prefer ECDHE over DHE for better performance,
# - prefer any AES-GCM and ChaCha20 over any AES-CBC for better performance and
#   security,
# - prefer AES-GCM over ChaCha20 because hardware-accelerated AES is common,
# - disable NULL authentication, MD5 MACs, DSS, and other
#   insecure ciphers for security reasons.
# - NOTE: TLS 1.3 cipher suites are managed through a different interface
#   not exposed by CPython (yet!) and are enabled by default if they're available.
DEFAULT_CIPHERS = ":".join(
    [
        "ECDHE+AESGCM",
        "ECDHE+CHACHA20",
        "DHE+AESGCM",
        "DHE+CHACHA20",
        "ECDH+AESGCM",
        "DH+AESGCM",
        "ECDH+AES",
        "DH+AES",
        "RSA+AESGCM",
        "RSA+AES",
        "!aNULL",
        "!eNULL",
        "!MD5",
        "!DSS",
    ]
)

_TYPE_PEER_CERT_RET = typing.Union["_TYPE_PEER_CERT_RET_DICT", bytes, None]

第二处:create_urllib3_context函数里

    # Unless we're given ciphers defer to either system ciphers in
    # the case of OpenSSL 1.1.1+ or use our own secure default ciphers.
    if ciphers:
        context.set_ciphers(ciphers)
    else: #added by from 3.6.8
        context.set_ciphers(DEFAULT_CIPHERS)

修改这处之后,不再报握手错误,正常连接

http://www.lryc.cn/news/402830.html

相关文章:

  • [深度学习]基于yolov10+streamlit目标检测演示系统设计
  • 开源模型应用落地-FastAPI-助力模型交互-进阶篇(三)
  • 机器人及其相关工科专业课程体系
  • C#数字医学影像系统(RIS/PACS)源码,Oracle数据库,C/S架构,运行稳定
  • Spring-Boot基础--yaml
  • C/C++蓝屏整人代码
  • 【Android安全】Ubuntu 下载、编译 、刷入Android-8.1.0_r1
  • HBuilder X3.4版本中使用uni-app自定义组件
  • PHP基础语法(一)
  • Python项目打包与依赖管理指南
  • 矿产资源潜力预测不确定性评价
  • 食堂采购系统开发:从需求分析到上线实施的完整指南
  • C++ 数据结构
  • Elasticsearch:评估搜索相关性 - 第 1 部分
  • 超声波清洗机哪款好用?保姆级教学,教你手把手挑选适合自己的超声波清洗机
  • vscode常用组件
  • IDEA创建普通Java项目
  • 华为“铁三角模式”在数据类项目中的应用和价值
  • P1-AI产品经理--九五小庞
  • PHP手边酒店多商户版平台小程序系统源码
  • 计算机视觉7 kag比赛
  • Go 协程通道使用注意
  • React基础学习-Day04
  • python爬虫获取网易云音乐评论歌词以及歌曲地址
  • 中间件的理解
  • django实现用户的注册、登录、注销功能
  • 【JAVA 常用API】数据库字段存储JSON格式数据,JAVA中如何将List<Entity>或者对象实体转换为字符串
  • AI算不出9.11和9.9哪个大?六家大模型厂商总结了这些原因
  • MacBook电脑远程连接Linux系统的服务器方法
  • CSS-0_3 CSS和单位