Skip to content

Commit 151fc7c

Browse files
committed
ZephyrSSLClient: add setCACert
1 parent cb54b92 commit 151fc7c

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

libraries/SocketWrapper/ZephyrClient.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ class ZephyrClient : public arduino::Client, ZephyrSocketWrapper {
3131
return ret;
3232
}
3333
#if defined(CONFIG_NET_SOCKETS_SOCKOPT_TLS)
34-
int connectSSL(const char* host, uint16_t port, char* cert) {
35-
auto ret = ZephyrSocketWrapper::connectSSL((char*)host, port, cert);
34+
int connectSSL(const char* host, uint16_t port, const char* cert) {
35+
auto ret = ZephyrSocketWrapper::connectSSL((char*)host, port, (char*)cert);
3636
if (ret) {
3737
_connected = true;
3838
}

libraries/SocketWrapper/ZephyrSSLClient.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,18 @@
88

99
#if defined(CONFIG_NET_SOCKETS_SOCKOPT_TLS)
1010
class ZephyrSSLClient : public ZephyrClient {
11+
private:
12+
const char* _cert = nullptr;
1113

1214
public:
1315
int connect(const char* host, uint16_t port) override {
14-
return connectSSL(host, port, nullptr);
16+
return connectSSL(host, port, _cert);
1517
}
16-
int connect(const char* host, uint16_t port, char* cert) {
18+
int connect(const char* host, uint16_t port, const char* cert) {
1719
return connectSSL(host, port, cert);
1820
}
21+
void setCACert(const char* cert) {
22+
_cert = cert;
23+
}
1924
};
2025
#endif

0 commit comments

Comments
 (0)