1 From ad534490eb71b16dfe53a6fced6267f0ea58b939 Mon Sep 17 00:00:00 2001
2 From: Scott Murray <scott.murray@konsulko.com>
3 Date: Mon, 11 Jul 2022 16:04:11 -0400
4 Subject: [PATCH] kuksa_viss_client: fix SSL context creation
6 With the newer Python and OpenSSL in Yocto kirkstone, specifying
7 ssl.Purpose.CLIENT_AUTH when creating the SSL context for the
8 connection results in the error:
10 Cannot create a client socket with a PROTOCOL_TLS_SERVER context
12 when trying to connect to a server with the client library. The fix
13 is to instead use ssl.Purpose.SERVER_AUTH, since the context will be
14 used by the client to validate the server certificate.
16 Signed-off-by: Scott Murray <scott.murray@konsulko.com>
18 kuksa_viss_client/__init__.py | 2 +-
19 1 file changed, 1 insertion(+), 1 deletion(-)
21 diff --git a/kuksa_viss_client/__init__.py b/kuksa_viss_client/__init__.py
22 index 69cc996..df7a540 100644
23 --- a/kuksa_viss_client/__init__.py
24 +++ b/kuksa_viss_client/__init__.py
25 @@ -227,7 +227,7 @@ class KuksaClientThread(threading.Thread):
27 async def mainLoop(self):
29 - context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
30 + context = ssl.create_default_context(ssl.Purpose.SERVER_AUTH)
31 context.load_cert_chain(certfile=self.certificate, keyfile=self.keyfile)
32 context.load_verify_locations(cafile=self.cacertificate)