I am trying to connect to one of my server in Python.

On my Windows 10 system when I issue a :

openssl s_client -connect host_ip:443

The result is :

---
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

Coming to python, I tried to set the SSL context and cipher:

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    
.
.
.

But I am getting error while making the connection:

[SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:1108)



    

System Version:

> 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
0

There are 0 best solutions below