Skip to content

Commit 9efbd3c

Browse files
committed
WiFiSSLClient: add setEccSlot method to configure client private key and certificate
1 parent be29127 commit 9efbd3c

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

Diff for: libraries/WiFiS3/src/WiFiSSLClient.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,17 @@ void WiFiSSLClient::setCACert(const char* root_ca, size_t size) {
6767
}
6868
}
6969

70+
/* -------------------------------------------------------------------------- */
71+
void WiFiSSLClient::setEccSlot(int ecc508KeySlot, const byte cert[], int certLength) {
72+
/* -------------------------------------------------------------------------- */
73+
getSocket();
74+
string res = "";
75+
if(certLength > 0) {
76+
modem.write_nowait(string(PROMPT(_SETECCSLOT)),res, "%s%d,%d,%d\r\n" , CMD_WRITE(_SETECCSLOT), _sock, ecc508KeySlot, certLength);
77+
modem.passthrough((uint8_t *)cert, certLength);
78+
}
79+
}
80+
7081
/* -------------------------------------------------------------------------- */
7182
size_t WiFiSSLClient::write(uint8_t b){
7283
/* -------------------------------------------------------------------------- */

Diff for: libraries/WiFiS3/src/WiFiSSLClient.h

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class WiFiSSLClient : public WiFiClient {
3434
virtual int connect(IPAddress ip, uint16_t port);
3535
virtual int connect(const char* host, uint16_t port);
3636
void setCACert(const char* root_ca = NULL, size_t size = 0);
37+
void setEccSlot(int ecc508KeySlot, const byte cert[], int certLength);
3738
virtual size_t write(uint8_t);
3839
virtual size_t write(const uint8_t *buf, size_t size);
3940
virtual int available();

0 commit comments

Comments
 (0)