Skip to content

WiFiS3: WiFiWebClientSSL fix information about CA Root certificate #278

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions libraries/WiFiS3/examples/WiFiWebClientSSL/WiFiWebClientSSL.ino
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
TLS WiFi Web client

Remember to update the CA certificates using CertificateUploader sketch
before using this sketch.
Board CA Root certificate bundle is embedded inside WiFi firmware:
https://github.com/arduino/uno-r4-wifi-usb-bridge/blob/main/certificates/cacrt_all.pem

Find the full UNO R4 WiFi Network documentation here:
https://docs.arduino.cc/tutorials/uno-r4-wifi/wifi-examples#wi-fi-web-client-ssl
Expand All @@ -12,7 +12,7 @@
#include "WiFiSSLClient.h"
#include "IPAddress.h"

#include "arduino_secrets.h"
#include "arduino_secrets.h"

///////please enter your sensitive data in the Secret tab/arduino_secrets.h
char ssid[] = SECRET_SSID; // your network SSID (name)
Expand All @@ -31,41 +31,41 @@ WiFiSSLClient client;

/* -------------------------------------------------------------------------- */
void setup() {
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
//Initialize serial and wait for port to open:
Serial.begin(115200);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}

// check for the WiFi module:
if (WiFi.status() == WL_NO_MODULE) {
Serial.println("Communication with WiFi module failed!");
// don't continue
while (true);
}

String fv = WiFi.firmwareVersion();
if (fv < WIFI_FIRMWARE_LATEST_VERSION) {
Serial.println("Please upgrade the firmware");
}

// attempt to connect to WiFi network:
while (status != WL_CONNECTED) {
Serial.print("Attempting to connect to SSID: ");
Serial.println(ssid);
// Connect to WPA/WPA2 network.
status = WiFi.begin(ssid, pass);

// wait 10 seconds for connection:
delay(10000);
}

printWifiStatus();

Serial.println("\nStarting connection to server...");
// if you get a connection, report back via serial:

if (client.connect(server, 443)) {
Serial.println("connected to server");
// Make a HTTP request:
Expand All @@ -79,7 +79,7 @@ void setup() {
/* just wrap the received data up to 80 columns in the serial print*/
/* -------------------------------------------------------------------------- */
void read_response() {
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
uint32_t received_data_num = 0;
while (client.available()) {
/* actual data reception */
Expand All @@ -88,15 +88,15 @@ void read_response() {
Serial.print(c);
/* wrap data to 80 columns*/
received_data_num++;
if(received_data_num % 80 == 0) {
if(received_data_num % 80 == 0) {
Serial.println();
}
}
}
}

/* -------------------------------------------------------------------------- */
void loop() {
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
read_response();

// if the server's disconnected, stop the client:
Expand All @@ -112,7 +112,7 @@ void loop() {

/* -------------------------------------------------------------------------- */
void printWifiStatus() {
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
// print the SSID of the network you're attached to:
Serial.print("SSID: ");
Serial.println(WiFi.SSID());
Expand Down