I want to create my own list of ciphersuites using the cipher strings. The following code works if I put only one string in the set_ciphers
function. But I want a customized list of ciphers. There is other format like: ALL:!COMPLEMENTOFDEFAULT:!eNULL
but this does not do the purpose I need. I have a customized list of different ciphers that I can not combine using the second format.
import socket, ssl
import pprint
context = ssl.create_default_context()
cipher = ['DHE-RSA-AES128-SHA', 'DHE-RSA-AES256-SHA', 'ECDHE-ECDSA-AES128-GCM-SHA256']
context.set_ciphers(cipher)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
domain = 'google.com'
sslSocket = context.wrap_socket(s, server_hostname = domain)
sslSocket.connect((domain, 443))
sslSocket.close()
print('closed')
The function set_ciphers
can be found here.