TLSv1 handshake failure when called do_handshake() error : OpenSSL.SSL.Error: [('SSL routines', '', 'no protocols available')]
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 944
- Forks
- 440
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 6
Description
Details :
Python 3.9.16
openssl version : OpenSSL 1.1.1v 1 Aug 2023 (Library: OpenSSL 1.1.1k FIPS 25 Mar 2021)
pyOpenSSL==23.2.0
Info:
I am trying to connect to my server using tlsv1 protocol, but facing error as
Traceback (most recent call last):
File "/root/test/test_tlsv1.py", line 29, in
ssl_connection(host, port)
File "/root/test/test_tlsv1.py", line 14, in ssl_connection
ssl_sock.do_handshake()
File "/usr/local/lib/python3.9/site-packages/OpenSSL/SSL.py", line 2182, in do_handshake
self._raise_ssl_error(self._ssl, result)
File "/usr/local/lib/python3.9/site-packages/OpenSSL/SSL.py", line 1823, in _raise_ssl_error
_openssl_assert(
File "/usr/local/lib/python3.9/site-packages/OpenSSL/_util.py", line 71, in openssl_assert
exception_from_error_queue(error)
File "/usr/local/lib/python3.9/site-packages/OpenSSL/_util.py", line 57, in exception_from_error_queue
raise exception_type(errors)
OpenSSL.SSL.Error: [('SSL routines', '', 'no protocols available')]
Python script I am using
from OpenSSL import SSL
import socket
def ssl_connection(host, port):
try:
context = SSL.Context(SSL.TLSv1_METHOD)
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
ssl_sock = SSL.Connection(context, sock)
except Exception as e:
print(e)
ssl_sock.connect((host, port))
ssl_sock.do_handshake()
print("Connected to:", ssl_sock.getpeername())
# Send and receive data
ssl_sock.send(b"Hello, server!")
data = ssl_sock.recv(1024)
print("Received:", data)
ssl_sock.shutdown()
ssl_sock.close()
if __name__ == "__main__":
host = "10.10.55.40"
port = 20166
ssl_connection(host, port)
Note: When I am using TLSv1_2 method it is working fine. My usecase is need to test with TLSv1 , TLSv1_1 and TLSv1_2 protocols.
Request to let me know how can I fix this issue. Let me know if need any detials
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the supplied test_tlsv1.py reproducer, especially SSL.Context(SSL.TLSv1_METHOD) and do_handshake(), using the listed Python, pyOpenSSL, and OpenSSL versions. Compare its behavior with TLSv1_2 and determine whether the failure reflects supported protocol behavior or a pyOpenSSL issue; done means establishing the cause and the required supported behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- networking, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100