mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
1.9 KiB
1.9 KiB
- orphan
Client Secure Class
Methods and properties described in this section are specific to ESP8266. They are not covered in Arduino WiFi library documentation. Before they are fully documented please refer to information below.
loadCertificate
Load client certificate from file system.
(file) loadCertificate
Declarations
#include <FS.h>
#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
const char* certyficateFile = "/client.cer";
setup() or loop()
if (!SPIFFS.begin())
{
.println("Failed to mount the file system");
Serialreturn;
}
.printf("Opening %s", certyficateFile);
Serial= SPIFFS.open(certyficateFile, "r");
File crtFile if (!crtFile)
{
.println(" Failed!");
Serial}
;
WiFiClientSecure client
.print("Loading %s", certyficateFile);
Serialif (!client.loadCertificate(crtFile))
{
.println(" Failed!");
Serial}
// proceed with connecting of client to the host
setCertificate
Load client certificate from C array.
(array, size) setCertificate
For a practical example please check this interesting blog.
Other Function Calls
bool verify (const char *fingerprint, const char *domain_name)
void setPrivateKey (const uint8_t *pk, size_t size)
bool loadCertificate (Stream &stream, size_t size)
bool loadPrivateKey (Stream &stream, size_t size)
template<typename TFile > bool loadPrivateKey (TFile &file)
Documentation for the above functions is not yet prepared.
For code samples please refer to separate section with examples dedicated specifically to the Client Secure Class.