5617eee9dd3bdf7fc9ee8b327fe01a1f759f26be
[AGL/meta-agl-demo.git] / recipes-connectivity / kuksa-val / kuksa-viss-client / 0001-kuksa_viss_client-fix-SSL-context-creation.patch
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
5
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:
9
10   Cannot create a client socket with a PROTOCOL_TLS_SERVER context
11
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.
15
16 Signed-off-by: Scott Murray <scott.murray@konsulko.com>
17 ---
18  kuksa_viss_client/__init__.py | 2 +-
19  1 file changed, 1 insertion(+), 1 deletion(-)
20
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):
26  
27      async def mainLoop(self):
28          if not self.insecure:
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)
33              try:
34 -- 
35 2.35.3
36