I had a little trouble getting the client connection to https://asksensors.com: this failed continuously. After doing a little Googling, I found that the the sample code didn't cope with the way in which WiFiClientSecure dealt with TLS connections. To get my connection working, I added the following at the beginning of the void setup() code:
Code: Select all
// Set Client to insecure
client.setInsecure();
However, if you do want to validate the certificate of the site that you are connecting to, rather than using the code above, try the following, again in the void setup() code:
Code: Select all
// Set target certificate fingerprint
client.setFingerprint(https_fingerprint);
Also of interest, the following commented code in the sample won't work when uncommented as the logic is superseded by the use of "setFingerprint()":
Code: Select all
// ignore certificate verification
/* if (client.verify(https_fingerprint, https_host)) {
Serial.println("-> certificate matches");
} else {
Serial.println("-> certificate doesn't match");
}
*/