Skip to content

Commit ad8fa55

Browse files
committed
ArduinoIoTCloudTCP: Add support for devices using SE050 crypto and WiFiSSLSE050Client
1 parent 0d4e790 commit ad8fa55

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/ArduinoIoTCloudTCP.cpp

+10-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828
#include "tls/utility/CryptoUtil.h"
2929
#endif
3030

31+
#ifdef BOARD_HAS_SE050
32+
#include "tls/AIoTCSSCert.h"
33+
#include "tls/utility/CryptoUtil.h"
34+
#endif
35+
3136
#ifdef BOARD_HAS_OFFLOADED_ECCX08
3237
#include <ArduinoECCX08.h>
3338
#include "tls/utility/CryptoUtil.h"
@@ -216,7 +221,7 @@ int ArduinoIoTCloudTCP::begin(bool const enable_watchdog, String brokerAddress,
216221
}
217222
#endif
218223

219-
#ifdef BOARD_HAS_ECCX08
224+
#if defined(BOARD_HAS_ECCX08) || defined(BOARD_HAS_SE050)
220225
if (!_crypto.begin())
221226
{
222227
DEBUG_ERROR("Cryptography processor failure. Make sure you have a compatible board.");
@@ -232,7 +237,11 @@ int ArduinoIoTCloudTCP::begin(bool const enable_watchdog, String brokerAddress,
232237
DEBUG_ERROR("Cryptography certificate reconstruction failure.");
233238
return 0;
234239
}
240+
#ifndef BOARD_HAS_SE050
235241
_sslClient.setClient(_connection->getClient());
242+
#else
243+
_sslClient.appendCustomCACert(AIoTSSCert);
244+
#endif
236245
_sslClient.setEccSlot(static_cast<int>(CryptoSlot::Key), _cert.bytes(), _cert.length());
237246
#elif defined(BOARD_ESP)
238247
_sslClient.setInsecure();

src/ArduinoIoTCloudTCP.h

+6
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
#include "tls/utility/CryptoUtil.h"
3232
#elif defined(BOARD_ESP)
3333
#include <WiFiClientSecure.h>
34+
#elif defined(BOARD_HAS_SE050)
35+
#include "tls/utility/CryptoUtil.h"
3436
#endif
3537

3638
#ifdef BOARD_HAS_OFFLOADED_ECCX08
@@ -143,6 +145,10 @@ class ArduinoIoTCloudTCP: public ArduinoIoTCloudClass
143145
#elif defined(BOARD_ESP)
144146
WiFiClientSecure _sslClient;
145147
String _password;
148+
#elif defined(BOARD_HAS_SE050)
149+
ArduinoIoTCloudCertClass _cert;
150+
WiFiSSLSE050Client _sslClient;
151+
CryptoUtil _crypto;
146152
#endif
147153

148154
MqttClient _mqttClient;

0 commit comments

Comments
 (0)