Code Monkey home page Code Monkey logo

esp_atmod's Introduction

ESP 8266 AT Firmware - modified for TLS 1.2

This firmware comes as an Arduino esp8266 sketch.

This file refers to version 0.3.6 of the firmware.

Purpose

The AT firmware provided by Espressif comes with basic TLS ciphersuites only. Especially, the lack of GCM-based ciphersuites makes the SSL part of the Espressif's firmware unusable on more and more web sites. This firmware addresses this issue.

The goal was to enable all modern ciphersuites implemented in BearSSL library included in esp8266/Arduino project including with some server authentication (server certificate checking).

The firmware fits into 1024 KB flash and can be run even on ESP-01 module with 8 Mbit flash.

Description

The firmware does not (and likely will not) implement the whole set of AT commands defined in Espressif's documentation.

The major differences are:

  1. Only TCP mode (with or without TLS) is supported, no UDP.

  2. In multiplex mode (AT+CIPMUX=1), 5 simultaneous connections are available. Due to memory constraints, there can be only one TLS (SSL) connection at a time with standard buffer size, more concurrent TLS connections can be made with a reduced buffer size (AT+CIPSSLSIZE). When the buffer size is 512 bytes, all 5 concurrent connections can be TLS.

New features:

  1. Implemented TLS security with state-of-the-art ciphersuites: certificate fingerprint checking or certificate chain verification.

  2. Implemented TLS MFLN check (RFC 3546), setting TLS receive buffer size, checking MFLN status of a connection.

Status

The firmware is still in work-in-progress state. It has been tested and is running on my devices but there might be deviations from the expected behaviour.

My testing environment uses the WifiEsp library and also the newer WiFiEspAT library.

The Future

Next development will be focused on

  1. More complete AT command implementation.

Installation

There are two options for compiling and flashing this library.

Arduino IDE

First you have to install Arduino IDE and the core for the ESP8266 chip. Next get all source files from this repository, place them in a folder named ESP_ATMod and compile and upload to your ESP module.

After flashing, the module will open serial connection on RX and TX pins with 115200 Bd, 8 bits, no parity. You can talk with the module using a serial terminal of your choice.

DISCLAIMER

Use the released Arduino IDE 1 and not the Arduino IDE 2.0 beta version. The beta version is not stable yet and contains a bug that messes up persistent wifi due the certificate uploads to the ESP's filesystem. Futhermore the Arduino IDE 2.0 beta version does not have the LittleFS Filesystem Uploader tool in place.

PlatformIO

An alternative to using the Arduino IDE is to use PlatformIO.

  1. Install PlatformIO
  2. Make sure that your device is in flashing mode
  3. In your favourite terminal and from the root of this repository, run the following command to build and upload the sketch to the device:
    platformio run --target upload
    

This has been configured and tested for the ESP-01 Black.

Add certificates

Certificates are stored in the ESP's filesystem with LittleFS. To add a certificate follow the following steps.

IMPORTANT: the certifcate must be in .pem format.

  1. Copy the certificate you want to the data directory in ESP_ATMod
  2. Install the LittleFS Filesystem Uploader
  3. Select Tools > ESP8266 LittleFS Data Upload menu item. This should start uploading the files into ESP8266 flash file system. When done, IDE status bar will display LittleFS Image Uploaded message. Might take a few minutes for large file system sizes.
  4. Now upload the ESP_ATMod sketch to the ESP.
  5. The certificate(s) you uploaded are now loaded and ready to use (you can check them with AT+CIPSSLCERT).
  6. (Optional) You may delete the .gitkeep file in the data directory. It is only there to push and pull the data directory in git. Not deleting the .gitkeep file won't do any harm.

AT Command List

In the following table, the list of supported AT commands is given. In the comment, only a difference between this implementation and the original Espressif's AT command firmware is given. The commands are implemented according to the Espressif's documentation, including the command order. Please refer to the Espressif's documentation for further information.

AT commands with _DEF and _CUR have (as in the standard AT firmware) an undocumented version without _DEF/CUR for backward compatibility (and forward too since AT 2 doesn't use _DEF/CUR). The command without _DEF/CUR behaves as _CUR for query and as _DEF for set (stores the parameters to the flash).

Command Description
Basic AT Commands
AT Test AT startup.
AT+RST Restart a module.
AT+GMR Check version information.
ATE Configure AT commands echoing.
AT+RESTORE Restore factory default settings of the module.
AT+UART_CUR Current UART configuration, not saved in flash.
AT+UART_DEF Default UART configuration, saved in flash.
AT+SYSRAM Query current remaining heap size and minimum heap size.
Wi-Fi AT Commands
AT+CWMODE Set the Wi-Fi mode (Station/SoftAP/Station+SoftAP).
AT+CWJAP_CUR Connect to an AP, parameter <pci_en> not implemented
AT+CWJAP_DEF Connect to AP, saved to flash. Parameter <pci_en> not implemented
AT+CWLAPOPT Set the configuration for the command AT+CWLAP.
AT+CWLAP List available APs.
AT+CWQAP Disconnect from an AP.
AT+CWSAP_CUR Start SoftAP, parameter <ecn> is not used. WPA_WPA2_PSK is used, if <pwd> is not empty.
AT+CWSAP_DEF Connect to AP, saved to flash. Parameter <ecn> is not used. WPA_WPA2_PSK is used, if <pwd> is not empty.
AT+CWDHCP_CUR Enable/disable DHCP - only station mode enabling works.
AT+CWDHCP_DEF Enable/disable DHCP saved to flash - only station mode enabling works.
AT+CWAUTOCONN Connect to an AP automatically when powered on.
AT+CIPSTAMAC_CUR Sets or prints the MAC Address of the ESP8266 Station. Only query is implemented.
AT+CIPSTAMAC_DEF Sets or prints the MAC Address of the ESP8266 Station stored in flash. Only query is implemented.
AT+CIPAPMAC_CUR Sets or prints the MAC Address of the ESP8266 SoftAP. Only query is implemented.
AT+CIPAPMAC_DEF Sets or prints the MAC Address of the ESP8266 SoftAP stored in flash. Only query is implemented.
AT+CIPSTA_CUR Query/Set the IP address of an ESP station.
AT+CIPSTA_DEF Set and/or print current IP address, gateway and network mask, stored in flash.
AT+CIPAP_CUR Query/Set the current IP address of the SoftAP.
AT+CIPAP_DEF Set and/or print SoftAP IP address, gateway and network mask, stored in flash.
AT+CWHOSTNAME Query/Set the host name of an ESP Station.
TCP/IP AT Commands
AT+CIPSTATUS Obtain the TCP/UDP/SSL connection status and information.
AT+CIPSTART Establish TCP connection, or SSL connection. Only one TLS connection at a time.
AT+CIPSSLSIZE Change the size of the receiver buffer (512, 1024, 2048 or 4096 bytes)
AT+CIPSEND Send data in the normal transmission mode or Wi-Fi passthrough mode.
AT+CIPCLOSEMODE Set the Close Mode of TCP Connection.
AT+CIPCLOSE Close TCP/SSL connection.
AT+CIFSR Obtain the local IP address and MAC address.
AT+CIPMUX Enable/disable the multiple connections mode. Max. 5 conections, only one of them can be TLS
AT+CIPSNTPCFG Query/Set the time zone and SNTP server.
AT+CIPSNTPTIME Query the SNTP time.
AT+CIPDINFO Set +IPD message mode.
AT+CIPRECVMODE Query/Set socket receiving mode.
AT+CIPRECVDATA Obtain socket data in passive receiving mode.
AT+CIPRECVLEN Obtain socket data length in passive receiving mode.
AT+CIPDNS_CUR Query/Set DNS server information.
AT+CIPDNS_DEF Default DNS setting, stored in flash
AT+CIPSERVER Deletes/Creates TCP Server
AT+CIPSERVERMAXCONN Set the maximum connections allowed by server
AT+CIPSTO Sets the TCP Server Timeout
New commands
AT+SYSCPUFREQ Set or query the current CPU frequency.
AT+RFMODE Set the physical wifi mode.
AT+CIPSSLAUTH Set and query the TLS authentication mode.
AT+CIPSSLFP Load or print the TLS server certificate fingerprint.
AT+CIPSSLCERTMAX Query or set the maximum amount of certificates that can be loaded.
AT+CIPSSLCERT Load, query or delete TLS CA certificate.
AT+CIPSSLMFLN Check if the site supports Maximum Fragment Length Negotiation (MFLN).
AT+CIPSSLSTA Prints the MFLN status of a connection.
AT+SNTPTIME Get SNTP time.

Changed Commands

AT+CIPSSLSIZE - Set the TLS Receiver Buffer Size

Sets the TLS receiver buffer size. The size can be 512, 1024, 2048, 4096 or 16384 (default) bytes according to RFC3546. The value is used for all subsequent TLS connections, the opened connections are not affected.

Command:

AT+CIPSSLSIZE=512

Answer:


OK

AT+CIPRECVMODE, AT+CIPRECVDATA, AT+CIPRECVLEN in SSL mode

Commands

  • AT+CIPRECVMODE (Set TCP or SSL Receive Mode)
  • AT+CIPRECVDATA (Get TCP or SSL Data in Passive Receive Mode)
  • AT+CIPRECVLEN (Get TCP or SSL Data Length in Passive Receive Mode)

Works in SSL mode in the same way as in TCP mode.

AT+CIPSERVER, AT+CIPSERVERMAXCONN and AT+CIPSTO

The standard AT firmware supports only one server. This firmware support up to 5 server with same AT+CIPCIPSERVER command.

In standard AT firmware 1.7 executing AT+CIPSERVER=1,<port> again even if the port is different prints no change and OK. Here it starts a new server. "no change" is returned only if maximum count of servers is reached.

In standard AT firmware 1.7 executing AT+CIPSERVER=0 stops the one server. Here it stops the first one. Executing AT+CIPSERVER=0,<port> stops the server listening on <port>.

CIPSERVERMAXCONN and CIPSTO are global settings, They apply to all servers.

New Commands

AT+SYSCPUFREQ - Set or query the Current CPU Frequency

Sets and queries the CPU freqency. The only valid values are 80 and 160 Mhz.

Query:

Command:

AT+SYSCPUFREQ?

Answer:

+SYSCPUFREQ=80

OK

Set:

Command:

AT+SYSCPUFREQ=<freq>

Answer:


OK

The value freq may be 80 or 160.

AT+RFMODE - Get and Change the Physical Wifi Mode

Sets and queries the physical wifi mode.

Query:

Command:

AT+RFMODE?

Answer:

+RFMODE=1

OK

Set:

Command:

AT+RFMODE=<mode>

Answer:


OK

The allowed values of <mode> are:

Mode Description
1 IEEE 802.11b
2 IEEE 802.11g
3 IEEE 802.11n

AT+CIPSSLAUTH - Set and Query the TLS Authentication Mode

Set or queries the selected TLS authentication mode. The default is no authentication. Try to avoid this because it is insecure and prone to MITM attack.

Query:

Command:

AT+CIPSSLAUTH?

Answer:

+CIPSSLAUTH=0

OK

Set:

Command:

AT+CIPSSLAUTH=<mode>

Answer:


OK

The allowed values of <mode> are:

Mode Description
0 No authentication. Default. Insecure
1 Server certificate fingerprint checking
2 Certificate chain checking

Switching to mode 1 succeeds only when the certificate SHA-1 fingerprint is preloaded (see AT+CIPSSLFP).

Switching to mode 2 succeeds only when the CA certificate preloaded (see AT+CIPSSLCERT).

AT+CIPSSLFP - Load or Print TLS Server Certificate SHA-1 Fingerprint

Load or print the saved server certificate fingerprint. The fingerprint is based on SHA-1 hash and is exactly 20 bytes long. When connecting, the TLS engine checks the fingerprint of the received certificate against the saved value. It ensures the device is connecting to the expected server. After a successful connection, the fingerprint is checked and is no longer needed for this connection.

The SHA-1 certificate fingerprint for a site can be obtained e.g. in browser while examining the server certificate.

Query:

Command:

AT+CIPSSLFP?

Answer:

+CIPSSLFP:"4F:D5:B1:C9:B2:8C:CF:D2:D5:9C:84:5D:76:F6:F7:A1:D0:A2:FA:3D"

OK

Set:

Command:

AT+CIPSSLFP="4F:D5:B1:C9:B2:8C:CF:D2:D5:9C:84:5D:76:F6:F7:A1:D0:A2:FA:3D"

or

AT+CIPSSLFP="4FD5B1C9B28CCFD2D59C845D76F6F7A1D0A2FA3D"

Answer:


OK

The fingerprint consists of exactly 20 bytes. They are set as hex values and may be divided with ':'.

AT+CIPSSLCERTMAX - Query or set maximum certificates to load

Currently maximum 5 certificates at a time can be loaded. With this command the amount of certificates to load with LittleFS can be adjusted.

Query amount to load:

Command:

AT+CIPSSLCERTMAX?

Answer:

+CIPSSLCERTMAX:5
OK

Set amount to load:

Command:

AT+CIPSSLCERTMAX=6

Answer:

+CIPSSLCERTMAX:6
OK

AT+CIPSSLCERT - Load, Query or Delete TLS CA Certificate

Load, query or delete CA certificate for TLS certificate chain verification. Currently maximum 5 certificates at a time can be loaded. The certificates must be in PEM structure. After a successful connection, the certificate is checked and is no longer needed for this connection.

Query the first certificate:

Command:

AT+CIPSSLCERT?

Answer:

+CIPSSLCERT:no cert

ERROR

or

+CIPSSLCERT,1:DST Root CA X3
+CIPSSLCERT,2:DST Root CA X3

OK

Query specific certificate:

Command:

AT+CIPSSLCERT?2

Answer:

+CIPSSLCERT,2:DST Root CA X3

OK

Set:

Command:

AT+CIPSSLCERT

Answer:


OK
>

You can now send the certificate (PEM encoding), no echo is given. After the last line (-----END CERTIFICATE-----), the certificate is parsed and loaded. The certificate should be sent with \n notation. For example isrg-root-x1-cross-signed.pem:

-----BEGIN CERTIFICATE-----
MIIFYDCCBEigAwIBAgIQQAF3ITfU6UK47naqPGQKtzANBgkqhkiG9w0BAQsFADA/
MSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT
DkRTVCBSb290IENBIFgzMB4XDTIxMDEyMDE5MTQwM1oXDTI0MDkzMDE4MTQwM1ow
TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh
cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwggIiMA0GCSqGSIb3DQEB
AQUAA4ICDwAwggIKAoICAQCt6CRz9BQ385ueK1coHIe+3LffOJCMbjzmV6B493XC
ov71am72AE8o295ohmxE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9VuG\nWCLKTVXkcGdtwlfFRjlBz4pYg1htmf5X6DYO8A4jqv2Il9DjXA6USbW1FzXSLr9O\nhe8Y4IWS6wY7bCkjCWDcRQJMEhg76fsO3txE+FiYruq9RUWhiF1myv4Q6W+CyBFC\nDfvp7OOGAN6dEOM4+qR9sdjoSYKEBpsr6GtPAQw4dy753ec5\n-----END CERTIFICATE-----

The application responds with

Read 1952 bytes

OK

or with an error message. In case of a successful loading, the certificate is ready to use and you can turn the certificate checking on (AT+CIPSSLAUTH=2).

The limit for the PEM certificate is 4096 characters total.

Delete a certificate:

Command:

AT+CIPSSLCERT=DELETE,1

Answer:

+CIPSSLCERT,1:deleted

OK

The certificate is deleted from the memory.

AT+CIPSSLMFLN - Checks if the given site supports the MFLN TLS Extension

The Maximum Fragment Length Negotiation extension is useful for lowering the RAM usage by reducing receiver buffer size on TLS connections. Newer TLS implementations support this extension but it would be wise to check the capability before changing a TLS buffer size and making a connection. As the server won't change this feature on the fly, you should test the MFLN capability only once.

Command:

AT+CIPSSLMFLN="site",port,size

The valid sizes are 512, 1024, 2048 and 4096.

AT+CIPSSLMFLN="www.github.com",443,512

Answer:

+CIPSSLMFLN:TRUE

OK

AT+CIPSSLSTA - Checks the status of the MFLN negotiation

This command checks the MFLN status on an opened TLS connection.

Command:

AT+CIPSSLSTA[=linkID]

The linkID value is mandatory when the multiplexing is on (AT+CIPMUX=1). It should be not entered when the multiplexing is turned off.

AT+CIPSSLSTA=0

Answer:

+CIPSSLSTA:1

OK

The returned value of 1 means there was a MFLN negotiation. It holds even with the default receiver buffer size set.

AT+SYSTIME - Returns the current time UTC

This command returns the current time as unix time (number of seconds since January 1st, 1970). The time zone is fixed to GMT (UTC). The time is obtained by querying NTP servers automatically, after connecting to the internet. Before connecting to the internet or in case of an error in communication with NTP servers, the time is unknown. This situation should be temporary.

Command:

AT+SYSTIME?

Answer:

+SYSTIME:1607438042
OK

If the current time is unknown, an error message is returned.

esp_atmod's People

Contributors

jandrassy avatar jiribilek avatar samgeens avatar ticklethepanda avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

esp_atmod's Issues

Settings never stored to EEPROM?

I don't see when are the Settings stored to EEPROM. There is EEPROM.end() but I think that is never executed.
I would expect EEPROM.commit() wrapped in Settings::commit() and called for _DEF commands.

Possible Wrong behaviour of AT+UART_CUR

If you use
AT+UART_CUR=,,,,control>
the original answers with
+AT_UART_CUR=,,,,

OK
-569 in comm
at the previous baudrate.
Here the answer is given at the new baudrate.

Immediate solution may be to put
Serial.printf_P(MSG_OK);
at line 550 in command.cpp and replace lines 566-569 in command.cpp by
if (error == 1)
Serial.printf_P(MSG_ERROR);
only.

Regards

AT command CWLAP

Hi, i have tested on ESP01S, i have sent a message to Telegram opening connection with AT+CIPSTART="SSL","api.telegram.org",443 and sent to chat id my message, all fine. :)

but maybe command for list of available network is not implemented? How to add it?

Thank you for your job.

ESP_ATMod does not reconnect to APs when using ESP8266 Arduino Core versions 3.0 or above

This is caused by a new breaking change to the ESP Arduino Core which was implemented this year (2021).
Persistence is now disabled by default in the new Core and WiFi also no longer reconnects at boot even if autoconnect is enabled.

enableWiFiAtBootTime() can be added to restore the legacy behaviour.
Alternatively, you can just call WiFi.begin() with no parameters just after you set WiFi defaults to initiate an attempt to connect to the last AP, if it exists.

Migration to Arduino Core 3.x

So far, the version 0.3.x was compiled with the old core v. 2.7.4.
The current core 3.0.2 introduced some breaking changes. This issue will address them.

  1. ESP_ATMod does not reconnect to APs (#11)
  2. Bad AT+CIPSTATUS (reply +CIPSTATUS:2,"SSL","(IP unset)",0,0,0) after connecting to and transferring data from web server.

The changes will be made to the branch Core_3 (https://github.com/JiriBilek/ESP_ATMod/tree/Core_3). They will result in a new version (probably 0.4).

Compilation error: use of deleted function 'BearSSL::X509List& BearSSL::X509List::operator=(const BearSSL::X509List&)'

C:\Users\Myself\iCloudDrive\Documents\Arduino\ESP_ATMod\ESP_ATMod\command.cpp: In function 'void cmd_AT_CIPSSLCERT()':
C:\Users\Myself\iCloudDrive\Documents\Arduino\ESP_ATMod\ESP_ATMod\command.cpp:2950:32: error: use of deleted function 'BearSSL::X509List& BearSSL::X509List::operator=(const BearSSL::X509List&)'
 2950 |     CAcert = BearSSL::X509List();
      |                                ^
In file included from C:\Users\Myself\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\ESP8266WiFi\src/WiFiClientSecureBearSSL.h:29,
                 from C:\Users\Myself\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\ESP8266WiFi\src/WiFiClientSecure.h:23,
                 from C:\Users\Myself\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\ESP8266WiFi\src/WiFiServerSecure.h:20,
                 from C:\Users\Myself\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\ESP8266WiFi\src/ESP8266WiFi.h:41,
                 from C:\Users\Myself\iCloudDrive\Documents\Arduino\ESP_ATMod\ESP_ATMod\command.cpp:23:
C:\Users\Myself\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\ESP8266WiFi\src/BearSSLHelpers.h:127:15: note: declared here
  127 |     X509List& operator=(const X509List& that) = delete;
      |               ^~~~~~~~
C:\Users\Myself\iCloudDrive\Documents\Arduino\ESP_ATMod\ESP_ATMod\ESP_ATMod.ino: In function 'void loop()':
C:\Users\Myself\iCloudDrive\Documents\Arduino\ESP_ATMod\ESP_ATMod\ESP_ATMod.ino:413:42: warning: 'WiFiClient WiFiServer::available(uint8_t*)' is deprecated: Renamed to accept(). [-Wdeprecated-declarations]
  413 |    WiFiClient cli = servers[i].available();
      |                                          ^
In file included from C:\Users\Myself\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\ESP8266WiFi\src/ESP8266WiFi.h:40,
                 from C:\Users\Myself\iCloudDrive\Documents\Arduino\ESP_ATMod\ESP_ATMod\ESP_ATMod.ino:60:
C:\Users\Myself\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\ESP8266WiFi\src/WiFiServer.h:85:14: note: declared here
   85 |   WiFiClient available(uint8_t* status = NULL) __attribute__((deprecated("Renamed to accept().")));
      |              ^~~~~~~~~

exit status 1

Compilation error: use of deleted function 'BearSSL::X509List& BearSSL::X509List::operator=(const BearSSL::X509List&)'

ESP-01S Heap Configuration

I'm using a generic ESP-01S module plugged in to an FTDI with Arduino IDE, and I've mostly left the settings on defaults except for setting "Debug" to "Serial".
I just cloned this repo today and flashed it to my module, and while it mostly seems to work fine, it appears to have trouble with verifying certificates. It fails with an error when I call AT+CIPSSLCERT, and based on the source it appears to be because it couldn't allocate the 4096 bytes needed on the heap to fit the PEM buffer.
Next, I tried adding the pem CA file via littleFS upload, and AT+CIPSSLCERT? query seemed to indicate that one certificate had loaded successfully. But when I attempt to query AT+CIPSSLCERT?1, it fails again with a non-descriptive error without printing out the cert details.
Finally, I tried turning on certificate chain verification and connecting to a test openssl s_server. It said "connect fail" and then "CLOSED". It was able to connect to the same server when chain verification was disabled.
Testing directly with openssl s_client on a PC with chain verification enabled and configured to use the cert as a CA file indicated that the server could be verified successfully.

I'm not sure if I'm supposed to be configuring Arduino IDE any differently to change the heap size/allocation algorithm, or if my particular module simply has less RAM than the ones you've tested.

Testing AT+SYSRAM? starting with default CIPSSLAUTH value on an SSL (aka TLSv1.2) connection:
Before connection: 43712
Active connection: 16032
After closing connection: 43480
After set AT+CIPSSLAUTH=2: 43480
After set AT+CIPSSLAUTH=0: 43536

EDIT: also asking, which version of the esp8266 core are you testing with?

Compilation error: use of deleted function

C:\Users\husse\Downloads\esp01-firmware-main\ESP_ATMod-master\ESP_ATMod\command.cpp: In function 'void cmd_AT_CIPSSLCERT()':
C:\Users\husse\Downloads\esp01-firmware-main\ESP_ATMod-master\ESP_ATMod\command.cpp:2950:32: error: use of deleted function 'BearSSL::X509List& BearSSL::X509List::operator=(const BearSSL::X509List&)'
 2950 |     CAcert = BearSSL::X509List();
      |                                ^
In file included from C:\Users\husse\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\ESP8266WiFi\src/WiFiClientSecureBearSSL.h:29,
                 from C:\Users\husse\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\ESP8266WiFi\src/WiFiClientSecure.h:23,
                 from C:\Users\husse\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\ESP8266WiFi\src/WiFiServerSecure.h:20,
                 from C:\Users\husse\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\ESP8266WiFi\src/ESP8266WiFi.h:41,
                 from C:\Users\husse\Downloads\esp01-firmware-main\ESP_ATMod-master\ESP_ATMod\command.cpp:23:
C:\Users\husse\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\ESP8266WiFi\src/BearSSLHelpers.h:127:15: note: declared here
  127 |     X509List& operator=(const X509List& that) = delete;
      |               ^~~~~~~~

exit status 1

Compilation error: use of deleted function 'BearSSL::X509List& BearSSL::X509List::operator=(const BearSSL::X509List&)'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.