From d17473d8a5fe40b6a28811fc5d97b63c25aaca9e Mon Sep 17 00:00:00 2001 From: Mate Szabo Date: Wed, 24 Aug 2022 11:20:00 +0100 Subject: [PATCH] Moves SSL cipher configuration after context creation Signed-off-by: Mate Szabo --- src/paho/mqtt/client.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/paho/mqtt/client.py b/src/paho/mqtt/client.py index 1c0236e4..0c7d1cf2 100644 --- a/src/paho/mqtt/client.py +++ b/src/paho/mqtt/client.py @@ -792,6 +792,9 @@ def tls_set(self, ca_certs=None, certfile=None, keyfile=None, cert_reqs=None, tl context = ssl.SSLContext(tls_version) # Configure context + if ciphers is not None: + context.set_ciphers(ciphers) + if certfile is not None: context.load_cert_chain(certfile, keyfile, keyfile_password) @@ -805,9 +808,6 @@ def tls_set(self, ca_certs=None, certfile=None, keyfile=None, cert_reqs=None, tl else: context.load_default_certs() - if ciphers is not None: - context.set_ciphers(ciphers) - self.tls_set_context(context) if cert_reqs != ssl.CERT_NONE: