admin管理员组文章数量:1606855
参考: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/Security/Server_Side_TLS
# - https://www.ssllabs/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)
修改这处之后,不再报握手错误,正常连接
本文标签: SSLV3ALERTHANDSHAKEFAILURESSL
版权声明:本文标题:python3.11SSL: SSLV3_ALERT_HANDSHAKE_FAILURE 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dianzi/1728514241a1161724.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论