我正在尝试用Python连接到我的一个服务器
在我的Windows 10系统上,当我发出以下命令时:
openssl s_client -connect host_ip:443
结果是:
---
SSL handshake has read 858 bytes and written 494 bytes
---
New, TLSv1/SSLv3, Cipher is RC4-SHA
Server public key is 1024 bit
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
Protocol : TLSv1.1
Cipher : RC4-SHA
谈到python,我尝试设置SSL上下文和密码:
ssl_context = ssl.create_default_context()
### The Following Changes Worked setting up the cipher ####
ciphers = ssl._DEFAULT_CIPHERS
# print (ciphers)
ciphers = re.sub(r":!RC4", "", ciphers)
# print(ciphers)
ciphers = ciphers + ":RC4-SHA"
ssl_context.set_ciphers(ciphers)
######################################################
ssl_context.options &= ~ssl.OP_NO_SSLv3 # I need to connect to a old server.
ssl_context.check_hostname = False
ssl_context.verify_mode = ssl.CERT_NONE
.
.
.
但我在建立连接时出错:
[SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:1108)
系统版本:
> openssl version
WARNING: can't open config file: /z/extlib/_openssl__/ssl/openssl.cnf
OpenSSL 1.0.2o 27 Mar 2018
> python --version
Python 3.8.3
> pip show pyOpenSSL
Name: pyOpenSSL
Version: 19.1.0
目前没有回答
相关问题 更多 >
编程相关推荐