From fae671fd0768ffd308064df5b25d0620947ae503 Mon Sep 17 00:00:00 2001 From: pennam Date: Tue, 26 Sep 2023 16:11:52 +0200 Subject: [PATCH] Initial: use Arduino_SecureElement library --- .../AWS IoT/AWS_IoT_WiFi/AWS_IoT_WiFi.ino | 31 ++++++++++++++++--- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/examples/AWS IoT/AWS_IoT_WiFi/AWS_IoT_WiFi.ino b/examples/AWS IoT/AWS_IoT_WiFi/AWS_IoT_WiFi.ino index f283b0d..2d0f3d9 100644 --- a/examples/AWS IoT/AWS_IoT_WiFi/AWS_IoT_WiFi.ino +++ b/examples/AWS IoT/AWS_IoT_WiFi/AWS_IoT_WiFi.ino @@ -20,10 +20,22 @@ This example code is in the public domain. */ -#include -#include +#include #include -#include // change to #include for MKR1000 +#if defined(ARDUINO_SAMD_MKR1000) + #include +#elif defined(ARDUINO_SAMD_MKRWIFI1010) || defined(ARDUINO_SAMD_NANO_33_IOT) + #include +#elif defined(ARDUINO_PORTENTA_C33) + #include + #include +#else + #error "Board not supported" +#endif + +#if defined(BOARD_HAS_ECCX08) + #include +#endif #include "arduino_secrets.h" @@ -33,8 +45,13 @@ const char pass[] = SECRET_PASS; const char broker[] = SECRET_BROKER; const char* certificate = SECRET_CERTIFICATE; + +#if defined(BOARD_HAS_ECCX08) WiFiClient wifiClient; // Used for the TCP socket connection BearSSLClient sslClient(wifiClient); // Used for SSL/TLS connection, integrates with ECC508 +#else +WiFiSSLClient sslClient; +#endif MqttClient mqttClient(sslClient); unsigned long lastMillis = 0; @@ -43,14 +60,18 @@ void setup() { Serial.begin(115200); while (!Serial); - if (!ECCX08.begin()) { - Serial.println("No ECCX08 present!"); + SecureElement secureElement; + + if (!secureElement.begin()) { + Serial.println("No Secure Element present!"); while (1); } +#if defined(BOARD_HAS_ECCX08) // Set a callback to get the current time // used to validate the servers certificate ArduinoBearSSL.onGetTime(getTime); +#endif // Set the ECCX08 slot to use for the private key // and the accompanying public certificate for it pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy