I was testing examples from Python SSL documentation,
and then I try use my own certificate it pop out this:
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)
I known this error is happening, because I am using self-signed certificate,
but I will not spent a lot of money, because it need to be varyfied.
I want to skip veryfication so it will use certificate as encryption.
How can I do that using that code:
Client:
import socket
import ssl
hostname = 'localhost'
context = ssl.create_default_context()
with socket.create_connection((hostname, 443)) as sock:
with context.wrap_socket(sock, server_hostname=hostname) as ssock:
print(ssock.version())
Server:
context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
context.load_cert_chain('certs/setver.crt', 'certs/private.key')
with socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0) as sock:
sock.bind(('127.0.0.1', 8443))
sock.listen(5)
with context.wrap_socket(sock, server_side=True) as ssock:
conn, addr = ssock.accept()
# Rest of the code...