From 449bd65cfbaede49d977ae5abe800f535c45c60b Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Sat, 8 Oct 2022 19:18:18 +0200 Subject: [PATCH] ucloud: Load root CA file from DER for MicroPython. * MicroPython now supports verifying root CA, passed as binary blob in cadata. --- arduino_iot_cloud/ucloud.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arduino_iot_cloud/ucloud.py b/arduino_iot_cloud/ucloud.py index e52514a..f025b51 100644 --- a/arduino_iot_cloud/ucloud.py +++ b/arduino_iot_cloud/ucloud.py @@ -195,8 +195,12 @@ def __init__( if "keyfile" in ssl_params and "der" in ssl_params["keyfile"]: with open(ssl_params.pop("keyfile"), "rb") as f: ssl_params["key"] = f.read() + if "certfile" in ssl_params and "der" in ssl_params["certfile"]: with open(ssl_params.pop("certfile"), "rb") as f: ssl_params["cert"] = f.read() + if "ca_certs" in ssl_params and "der" in ssl_params["ca_certs"]: + with open(ssl_params.pop("ca_certs"), "rb") as f: + ssl_params["cadata"] = f.read() # If no server/port were passed in args, set the default server/port # based on authentication type.