Ok, I figured out what was wrong. It was kind of foolish of me. I had two problems with my code. My first mistake was when specifying the ssl_version I put in TLSv1 when it should have been ssl.PROTOCOL_TLSv1. The second mistake was that I wasn't referencing the wrapped socket, instead I was calling the original socket that I have created. The below code seemed to work for me.

import socket
import ssl

# SET VARIABLES
packet, reply = "<packet>SOME_DATA</packet>", ""
HOST, PORT = 'XX.XX.XX.XX', 4434

# CREATE SOCKET
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(10)

# WRAP SOCKET
wrappedSocket = ssl.wrap_socket(sock, ssl_version=ssl.PROTOCOL_TLSv1, ciphers="ADH-AES256-SHA")

# CONNECT AND PRINT REPLY
wrappedSocket.connect((HOST, PORT))
wrappedSocket.send(packet)
print wrappedSocket.recv(1280)

# CLOSE SOCKET CONNECTION
wrappedSocket.close()

Hope this can help somebody!

Answer from Raffi on Stack Overflow
🌐
Python
docs.python.org › 3 › library › ssl.html
ssl — TLS/SSL wrapper for socket objects
Source code: Lib/ssl.py This module provides access to Transport Layer Security (often known as “Secure Sockets Layer”) encryption and peer authentication facilities for network sockets, both clien...
🌐
PyPI
pypi.org › project › ssl
ssl · PyPI
April 20, 2013 - The old socket.ssl() support for TLS over sockets is being superseded in Python 2.6 by a new ‘ssl’ module.
      » pip install ssl
    
Published   Apr 20, 2013
Version   1.16
Discussions

Opening a SSL socket connection in Python - Stack Overflow
I'm trying to establish a secure socket connection in Python, and i'm having a hard time with the SSL bit of it. I've found some code examples of how to establish a connection with SSL, but they all More on stackoverflow.com
🌐 stackoverflow.com
"ssl module in Python is not available" when installing package with pip3 - Stack Overflow
I've install Python 3.4 and Python 3.6 on my local machine successfully, but am unable to install packages with pip3. When I execute pip3 install , I get the following SSL related e... More on stackoverflow.com
🌐 stackoverflow.com
How to establish an SSL socket connection in Python without certificates - TestMu AI Community
How can I establish an SSL socket connection in Python ssl without needing to provide key files or certificates? I’m trying to create a secure socket connection in Python, but I’m struggling with the SSL part. The server I’m trying to connect to does not require any keys or certificates. More on community.testmuai.com
🌐 community.testmuai.com
0
December 19, 2024
Python 3.13.x SSL security changes
My organization currently uses Zscaler for security and VPN. On top of that I have no admin rights to my Windows machine. I have tried a whole host of solutions which led me to pip-system-certs is this StackOverflow question that is quite similar to my situation here https://stackoverflow.... More on discuss.python.org
🌐 discuss.python.org
15
0
May 8, 2025
🌐
W3Schools
w3schools.com › python › ref_module_ssl.asp
Python ssl Module
The ssl module provides TLS/SSL wrapper functionality for socket objects to create secure network connections.
🌐
GeeksforGeeks
geeksforgeeks.org › python › how-to-install-and-use-ssl-certificate-in-python
How to Install and use SSL Certificate In Python - GeeksforGeeks
July 23, 2025 - HTTPS: It is a combination of the HTTP with the Secure Socket Layer (SSL)/Transport Layer Security (TLS) protocol. TLS: It is an authentication and security protocol widely implemented in browsers and Web servers.
Find elsewhere
🌐
GitHub
github.com › mitchmoser › Python-SSL-Certificates
GitHub - mitchmoser/Python-SSL-Certificates · GitHub
The Python Requests library uses its own CA file by default, or will use the certifi package's certificate bundle if installed. Frost performs SSL interception that re-signs the certificates using it's own intermediates, causing errors for external URLs like so:
Author   mitchmoser
🌐
Snyk
snyk.io › blog › implementing-tls-ssl-python
Implementing TLS/SSL in Python | Snyk
October 16, 2022 - Then, we’ll walk through the steps for adding TLS to your Python application on Linux. The TLS protocol, the successor of the secure socket layer (SSL) protocol, protects data using encryption.
🌐
GitHub
github.com › python › cpython › blob › main › Lib › ssl.py
cpython/Lib/ssl.py at main · python/cpython
# Wrapper module for _ssl, providing some additional facilities · # implemented in Python.
Author   python
🌐
Pyopenssl
pyopenssl.org › en › latest › api › ssl.html
SSL — An interface to the SSL-specific parts of OpenSSL — pyOpenSSL 26.0.0 documentation
The first integer specifies where in the SSL handshake the function was called, and the other the return code from a (possibly failed) internal function call. ... Set the TLS key logging callback to callback. This function will be called whenever TLS key material is generated or received, in order to allow applications to store this keying material for debugging purposes. ... callback – The Python callback to use.
🌐
TestMu AI Community
community.testmuai.com › ask a question
How to establish an SSL socket connection in Python without certificates - TestMu AI Community
December 19, 2024 - How can I establish an SSL socket connection in Python ssl without needing to provide key files or certificates? I’m trying to create a secure socket connection in Python, but I’m struggling with the SSL part. The serve…
🌐
Python.org
discuss.python.org › python help
Python 3.13.x SSL security changes - Python Help - Discussions on Python.org
May 8, 2025 - My organization currently uses Zscaler for security and VPN. On top of that I have no admin rights to my Windows machine. I have tried a whole host of solutions which led me to pip-system-certs is this StackOverflow question that is quite similar to my situation here https://stackoverflow.com/questions/61635505/installing-zscaler-certificate-to-anaconda3 For Python 3.12, I was able to patch the cert by using autowrapt which was kindly provided by pip-system-certs.
🌐
Python Software Foundation
wiki.python.org › python › SSL.html
SSL
For current information, please visit python.org. If a change to this archive is absolutely needed, requests can be made via the infrastructure@python.org mailing list. SSL stands for Secure Sockets Layer and is designed to create secure connection between client and server.
🌐
MicroPython
docs.micropython.org › en › latest › library › ssl.html
ssl – SSL/TLS module — MicroPython latest documentation
Wrap the given sock and return a new wrapped-socket object. The implementation of this function is to first create an SSLContext and then call the SSLContext.wrap_socket method on that context object. The arguments sock, server_side and server_hostname are passed through unchanged to the method ...
🌐
Readthedocs
python-security.readthedocs.io › ssl.html
Python SSL and TLS security — Python Security 0.0 documentation
New in Python 3.2. ... SSLContext.load_verify_locations(): This method can also load certification revocation lists (CRLs) in PEM or DER format.
🌐
Codiga
codiga.io › blog › python-ssl-versions
SSL module in Python: stay secure!
October 17, 2022 - The Python ssl module provides functions and classes to use Secure Sockets Layer (SSL) and Transport Layer Security (TLS) to secure communication both server and client side.
🌐
GeeksforGeeks
geeksforgeeks.org › python › ssl-certificate-verification-python-requests
SSL Certificate Verification - Python requests - GeeksforGeeks
July 12, 2025 - By default, SSL verification is enabled, and Requests will throw a SSLError if it’s unable to verify the certificate.