Skip to content
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

Please add example for TLS rootCa verification #17

Open
RoSchmi opened this issue Mar 14, 2021 · 0 comments
Open

Please add example for TLS rootCa verification #17

RoSchmi opened this issue Mar 14, 2021 · 0 comments

Comments

@RoSchmi
Copy link

RoSchmi commented Mar 14, 2021

First: Thank you very much for your excellent work!
Board: Teensy 4.1
IDE: Platformio
Latest version of NativeEthernet library

I successfully followed the example 'WebClientRepeatingTLS' and could read from the page 'pjrc.com/about/contact.html'.
However I was not successful to get rootCa verification working. Is it supported?
I downloaded the root certificate DST Root CA X3 in the base64 encoded form from pjrc.com.

const char *dst_root_ca =
"-----BEGIN CERTIFICATE-----\n"
"MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/\n"
"MSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT\n"
"DkRTVCBSb290IENBIFgzMB4XDTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVow\n"
"PzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3QgQ28uMRcwFQYDVQQD\n"
"Ew5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB\n"
"AN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3ZJKuM/IUmTrE4O\n"
"rz5Iy2Xu/NMhD2XSKtkyj4zl93ewEnu1lcCJo6m67XMuegwGMoOifooUMM0RoOEq\n"
"OLl5CjH9UL2AZd+3UWODyOKIYepLYYHsUmu5ouJLGiifSKOeDNoJjj4XLh7dIN9b\n"
"xiqKqy69cK3FCxolkHRyxXtqqzTWMIn/5WgTe1QLyNau7Fqckh49ZLOMxt+/yUFw\n"
"7BZy1SbsOFU5Q9D8/RhcQPGX69Wam40dutolucbY38EVAjqr2m7xPi71XAicPNaD\n"
"aeQQmxkqtilX4+U9m5/wAl0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNV\n"
"HQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMSnsaR7LHH62+FLkHX/xBVghYkQMA0GCSqG\n"
"SIb3DQEBBQUAA4IBAQCjGiybFwBcqR7uKGY3Or+Dxz9LwwmglSBd49lZRNI+DT69\n"
"ikugdB/OEIKcdBodfpga3csTS7MgROSR6cz8faXbauX+5v3gTt23ADq1cEmv8uXr\n"
"AvHRAosZy5Q6XkjEGB5YGV8eAlrwDPGxrancWYaLbumR9YbK+rlmM6pZW87ipxZz\n"
"R8srzJmwN0jP41ZL9c8PDHIyh8bwRLtTcm1D9SZImlJnt1ir/md2cXjbDaJWFBM5\n"
"JDGFoqgCWjBH4d1QB7wCCZAA62RjYJsWvIjJEubSfZGL+T0yjWW06XyxV3bqxbYo\n"
"Ob8VZRzI9neWagqNdwvYkQsEjgfbKbYK7p2CNTUQ\n"
"-----END CERTIFICATE-----";

and entered the certificate through:

 client.setCACert((char *)dst_root_ca, strlen(dst_root_ca));

But I got error messages:

Initialize Ethernet with DHCP:
DHCP assigned IP 192.168.1.102
You're connected to the network, IP = 192.168.1.102
TLS ca certificate error.
connecting...
HTTP/1.1 400 Bad Request
Date: Sun, 14 Mar 2021 18:10:08 GMT
Server: Apache/2.4.18 (Ubuntu)
Strict-Transport-Security: max-age=15552000
Cache-Control: stale-while-revalidate=30
Content-Length: 441
Connection: close
Content-Type: text/html; charset=iso-8859-1

<title>400 Bad Request</title>

Bad Request

Your browser sent a request that this server could not understand.
Reason: You're speaking plain HTTP to an SSL-enabled server port.
Instead use the HTTPS scheme to access this URL, please.


Apache/2.4.18 (Ubuntu) Server at www.pjrc.com Port 443 SockIndex: 0 SockStatus: 17 RecvErr: -26 SockIndex: 0 SockStatus: 17 RecvErr: -26 ...... ...... ...... Thanks in advance
@RoSchmi RoSchmi changed the title Please add example for TLS rootCa verifcation Please add example for TLS rootCa verification Mar 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant