Ethernet post data via HTTPS

Hi,

May i know how to post the HTTPS data via ethernet? Below is simple code to post data via HTTP, but how about HTTPS in SSL?

    client.println("POST /test.php HTTP/1.1");
    client.println("Host: api.test.com");
    client.println("Cache-Control: no-cache");
    client.println("Content-Type: application/x-www-form-urlencoded");

May i know how to post the HTTPS data via ethernet? Below is simple code to post data via HTTP, but how about HTTPS in SSL?

It's exactly the same but the class "client" in your sample code must know TLS (SSL is not in use anymore todays).

A standard Arduino isn't able to do HTTPS (or any other TLS socket connection). As you did neither mention the Arduino model you use nor the Ethernet hardware attached we cannot help you further.

Hi, im using Ethernet Shield V2.0 with Wiznet W5100 ethernet chip. If using TLS, can i have some sample code?

Hi, im using Ethernet Shield V2.0 with Wiznet W5100 ethernet chip.

This hardware isn't able to do TLS.

Hi Pylon, thank you for your reply. Is there any solution to post a data to server with https?

kentlim04:
Is there any solution to post a data to server with https?

With just an Arduino? No.

With an ESP8266 or other ESP boards? Yes.

1 Like

ok noted with thanks.

Hello,

I don't have a big knowledge about networking and I'm so curious:
why e.g. W5100 or ENC28J60 can't handle TLS but ESP8266 can? If these devices service TCP protocol, doesn't it mean they can do everything what relies on TCP?

I found here a short discussion about it: ESP8266+ENC28j60 Secure (WSS) SocketIO support · Issue #301 · Links2004/arduinoWebSockets · GitHub and in the reply there's interesting information that "the ENC28J60 can be registered in to the TCP stack (lwip) of the ESP" - which can indicate that ESP has some abities that ENC doesn't. Also interesting is: "there are some ENC28J60 lwip drivers out there but no one has ported them to arduino"...

br,
Laskipaa

why e.g. W5100 or ENC28J60 can't handle TLS but ESP8266 can? If these devices service TCP protocol, doesn't it mean they can do everything what relies on TCP?

The hardware can initiate a TCP connection but the CPU cannot handle TLS for one because the processing power isn't high enough for the other because of limited RAM. You might get it running using an ARM based Arduino model but with an UNO just forget it (OP didn't stated it's Artuino model so we always assume an UNO as that's the standard model). Feel free to implement a TLS library for the Ethernet Shield together with an Due (for example).

SSLClient works on SAMD21 with Ethernet 2.0 library. Arduino boards with SAMD21 include Zero and the MKR series. Other companies also make Arduino compatible boards using the SAMD21.

You know if can I use an ESP8266 with a ENC28j60 or W5500 to send a GET request to a HTTS web service (Using SSL)?

OnJuanTrack:
You know if can I use an ESP8266 with a ENC28j60 or W5500 to send a GET request to a HTTS web service (Using SSL)?

You need to check if ESP libraries exists for the ENC28j60 / W5500 modules. I would pick an ESP32, which is the faster and newer successor to ESP8266. Also bear in mind that ESP modules have onboard WiFi, so if you can connect to WiFi you do not need an extra ethernet module at all.

I use Arduino UNO. With this device model, how to make TLS connection?
My purpose is to make the HTTPS connection and get data.
Thank you for your advice.

ChunTianHong:
I use Arduino UNO. With this device model, how to make TLS connection? My purpose is to make the HTTPS connection and get data. Thank you for your advice.

AFAIK, UNO cannot handle TLS.

EDIT: Try to look at this.

@Danois90: Forget your edit, an UNO cannot handle TLS, it will never. You can add a ESP8266 (just an example) and let it doing the TLS but that wasn't the question because if you have an ESP8266 in most cases you don't need an UNO. You can also connect the UNO to a Raspberry Pi and let the Pi do the TLS but the UNO cannot do it.