python - 确定 SSL 包使用的默认协议(protocol)版本?

标签 python ssl python-requests pyopenssl

在 python 中,如何确定 SSL 包或请求默认使用哪个 SSL 或 TLS 协议(protocol)。

比如 TLSv1 与 SSLv3。

最佳答案

SSL socket creation Python 文档的部分包含有关 SSL 包的信息:

The parameter ssl_version specifies which version of the SSL protocol to use. Typically, the server chooses a particular protocol version, and the client must adapt to the server’s choice. Most of the versions are not interoperable with the other versions. If not specified, the default is PROTOCOL_SSLv23 it provides the most compatibility with other versions.

Here’s a table showing which versions in a client (down the side) can connect to which versions in a server (along the top):

| client / server | SSLv2 | SSLv3 | SSLv23 | TLSv1 | TLSv1.1 | TLSv1.2 |
|-----------------|-------|-------|--------|-------|---------|---------|
| SSLv2           | yes   | no    | yes    | no    | no      | no      |
| SSLv3           | no    | yes   | yes    | no    | no      | no      |
| SSLv23          | no    | yes   | yes    | yes   | yes     | yes     |
| TLSv1           | no    | no    | yes    | yes   | no      | no      |
| TLSv1.1         | no    | no    | yes    | no    | yes     | no      |
| TLSv1.2         | no    | no    | yes    | no    | no      | yes     |

Note:

Which connections succeed will vary depending on the version of OpenSSL. For example, before OpenSSL 1.0.0, an SSLv23 client would always attempt SSLv2 connections.

关于python - 确定 SSL 包使用的默认协议(protocol)版本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39862559/

相关文章:

ssl - 浏览器多久会自动重置 SSL 缓存?

python - 为什么我的 SurveyMonkey API 获取请求收到 403 错误响应?

python - 如何在 python 中按年份对行对象列表进行分组?

python - 如何使用python根据单元格值获取Excel单元格行和列

r - 使用 R 通过 SSL 连接到 Postgres

python - python请求的正确使用方法是什么

Python 请求。错误 403

python - 具有不同和依赖步骤的嵌套循环

python - 迁移学习类型错误: 'module' object is not callable

c# - 机器特定的 HttpWebResponse 超时