Simple TLS/SSL Ethernet WebServer, HTTP Client and WebSocket Client library for for AVR, Portenta_H7, Teensy, SAM DUE, SAMD21, SAMD51, STM32F/L/H/G/WB/MP1, nRF52 and RASPBERRY_PI_PICO boards using Ethernet shields W5100, W5200, W5500, ENC28J60 or Teensy 4.1 NativeEthernet/QNEthernet. It now supports Ethernet TLS/SSL Client. The library supports HTTP/HTTPS GET and POST requests, provides argument parsing, handles one client at a time. It supports Arduino boards (SAM DUE, Atmel SAM3X8E ARM Cortex-M3, SAMD21, SAMD51, ESP8266, ESP32, Adafruit nRF52, Teensy boards) using Wiznet W5x00 or ENC28J60 network shields. Ethernet_Generic library is used as default for W5x00 with custom SPI
GNU General Public License v3.0
46
stars
10
forks
source link
SSLClientParameters mTLS not at beginning but at runtime #31
not at the beginning of the module but at runtime inside another function.
I explain you why i need to do this it is because i want to read from a txt file the certificates and keys for the connection instead of change the code manually for every device that is deployed.
But when i try to do this
uint8_t setup_ethernet(void)
{
uint8_t result_connection = 0;
/*retrieve security info for aws from memory*/
Load_secrets_from_memory();
SSLClientParameters mTLS = SSLClientParameters::fromPEM(my_cert, sizeof my_cert, my_key, sizeof my_key);
/*authentication on aws*/
ethClientSSL.setMutualAuthParams(mTLS);
Ethernet.init(ETH_CS, ðernetSPI, ETH_SCLK, ETH_MISO, ETH_MOSI);
Serial.begin(115200);
while (!Serial)
{
; // wait for serial port to connect. Needed for native USB port only
}
Ethernet.begin(mac, TIME_OUT_WAITING_ETH_CABLE);
// Check for Ethernet hardware present
if (Ethernet.hardwareStatus() == EthernetNoHardware)
{
result_connection = 1;
Serial.println("Ethernet shield was not found. Sorry, can't run without hardware. :(");
while (true)
{
delay(1); // do nothing, no point running without Ethernet hardware
}
}
if (Ethernet.linkStatus() == LinkOFF)
{
result_connection = 1;
Serial.println("Ethernet cable is not connected.");
}
Serial.print("Joined LAN with IP ");
Serial.println(Ethernet.localIP());
Serial.flush();
setup_time();
// Create a message handler
mqtt_istance.setCallback(callback);
return result_connection;
}
my esp32 is crashing and restarting..
I wonder if in your opinion it is possible to call that instruction once i have read the txt file..
Hi @khoih-prog ..
I hope you are fine and well. I have already tried your lib and it is working well but i have the need to call this istruction..
SSLClientParameters mTLS = SSLClientParameters::fromPEM(my_cert, sizeof my_cert, my_key, sizeof my_key);
not at the beginning of the module but at runtime inside another function.
I explain you why i need to do this it is because i want to read from a txt file the certificates and keys for the connection instead of change the code manually for every device that is deployed.
But when i try to do this
my esp32 is crashing and restarting..
I wonder if in your opinion it is possible to call that instruction once i have read the txt file..
Thanks a lot for your help