Client Secure Class¶
Methods and properties described in this section are specific to ESP8266. They are not covered inArduino WiFi library documentation. Before they are fully documented please refer to information below.
Supported crypto¶
In the background the libraryaxtls is used. The library supports only rsa certificates and no new eliptic curve certificates. TLSv1.2 is supported since SDK 2.4.0-rc1.
The following ciphers and digests are supported byspecification:
- Symmetric Ciphers
- AES128-SHA
- AES256-SHA
- AES128-SHA256
- AES256-SHA256
- Asymmetric Ciphers
- RSA 512/1024/2048/4096 bit encryption/decryption.
- RSA signing/verification
- Digests
- SHA1
- MD5
- SHA256/384/512
- HMAC-SHA1
- HMAC-MD5
- HMAC-SHA256
loadCertificate¶
Load client certificate from file system.
loadCertificate(file)
Declarations
#include <FS.h>#include <ESP8266WiFi.h>#include <WiFiClientSecure.h>constchar*certyficateFile="/client.cer";
setup() or loop()
if (!SPIFFS.begin()){ Serial.println("Failed to mount the file system"); return;}Serial.printf("Opening %s", certyficateFile);File crtFile = SPIFFS.open(certyficateFile, "r");if (!crtFile){ Serial.println(" Failed!");}WiFiClientSecure client;Serial.print("Loading %s", certyficateFile);if (!client.loadCertificate(crtFile)){ Serial.println(" Failed!");}// proceed with connecting of client to the hostsetCertificate¶
Load client certificate from C array.
setCertificate(array,size)
For a practical example please checkthis interesting blog.
Other Function Calls¶
boolverify(constchar*fingerprint,constchar*domain_name)voidsetPrivateKey(constuint8_t*pk,size_tsize)boolloadCertificate(Stream&stream,size_tsize)boolloadPrivateKey(Stream&stream,size_tsize)template<typenameTFile>boolloadPrivateKey(TFile&file)
Documentation for the above functions is not yet prepared.
For code samples please refer to separate section withexamples dedicated specifically to the Client Secure Class.