Python Forum

Full Version: Problem connecting TLS client written in C++ and Twisted server
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm trying to get a TLS (encrypted) connection between a client program written in C++ using the Boost::Asio framework and a server written using the Twisted framework in Python. I can connect to the server using a client written using Twisted and the C++ program can talk to a C++ TLS server written with Boost. The problems seem to arise from using the two together. When I try connecting to the server the connection dies with this kind of error. I've tried basically every setting for the SSL context in Boost and a number of other settable options. One odd thing that I can tell you right now is that setting options like boost::asio::ssl::context::no_sslv3 still produces the same error. I'm assuming the Boost library doesn't ignore its own settings so I'm wondering why our Twisted server is complaining about a protocol it shouldn't be using.

[c 2022-06-12 00:47:05.328804] connectionLost reason: [Failure instance: Traceback: <class 'OpenSSL.SSL.Error'>: [('SSL routines', 'ssl3_get_record', 'decryption failed or bad record mac')]
/home/greg/vast-dev_gp3/ve/lib/python3.6/site-packages/twisted/internet/posixbase.py:614:_doReadOrWrite
/home/greg/vast-dev_gp3/ve/lib/python3.6/site-packages/twisted/internet/tcp.py:243:doRead
/home/greg/vast-dev_gp3/ve/lib/python3.6/site-packages/twisted/internet/tcp.py:249:_dataReceived
/home/greg/vast-dev_gp3/ve/lib/python3.6/site-packages/twisted/protocols/tls.py:330:dataReceived
--- <exception caught here> ---
/home/greg/vast-dev_gp3/ve/lib/python3.6/site-packages/twisted/protocols/tls.py:274:_flushReceiveBIO
/home/greg/vast-dev_gp3/ve/lib/python3.6/site-packages/OpenSSL/SSL.py:1783:recv
/home/greg/vast-dev_gp3/ve/lib/python3.6/site-packages/OpenSSL/SSL.py:1639:_raise_ssl_error
/home/greg/vast-dev_gp3/ve/lib/python3.6/site-packages/OpenSSL/_util.py:54:exception_from_error_queue
]
~Greg