I am having a problem when trying to set TLS1.3 ciphers for ssl contexts in python, particularly 'TLS_AES_128_CCM_SHA256'.
OS: Windows 7
Python version: 3.7.4
OpenSSL version: 1.1.1c
By default, when i'm not setting cipher suites, it can be seen in the TLS handshake that the client does offer some TLS1.3 ciphers, but not the ones I need.
import ssl
if __name__ == '__main__':
ctx = ssl.SSLContext(ssl.PROTOCOL_TLS)
ctx.set_ciphers('TLS_AES_128_CCM_SHA256')
print(ctx.get_ciphers())
The error I receive:
ssl.SSLError:('No cipher can be selected.',)
This is because set_ciphers does not apply to TLSv1.3, so you can't enable nor disable those cipher suite (In your example "TLS_AES_128_CCM_SHA256" is one of them.)
source = https://docs.python.org/3/library/ssl.html#ssl.SSLContext.set_ciphers