Skip to content

Can't get Let's Encrypt certificates to work #88

Closed
@kaiomatico

Description

@kaiomatico

Describe Your Goal
I want to convert my valid let's encrypt certificate to the correct DER format to use it on the HTTPS Async example

What Does Your Project Look Like
The example HTTPS Async sketch with only the cert.h and private_key.h replaced. I got the following files from Let's Encrypt:

  • cert.pem
  • chain.pem
  • fullchain.pem
  • privkey.pem

I have tried the following commands with varying level of success to generate the example.crt.DER which then gets converted to cert.h with xxd:

  • openssl x509 -in fullchain.pem -outform DER -out example.crt.DER
  • openssl x509 -in cert.pem -outform DER -out example.crt.DER
  • opening a properly configured Apache webserver with the certificate and then download the certificate with chrome and saving it as DER file. (I have tried it at the root level as well as only on the domain level)

I test using curl -v which always fails at :

  • ALPN, offering h2
  • ALPN, offering http/1.1
  • successfully set certificate verify locations:
  • CAfile: /etc/ssl/certs/ca-certificates.crt
    CApath: /etc/ssl/certs
  • TLSv1.3 (OUT), TLS handshake, Client hello (1):
  • TLSv1.3 (IN), TLS handshake, Server hello (2):
  • TLSv1.2 (IN), TLS handshake, Certificate (11):
  • TLSv1.2 (OUT), TLS alert, unknown CA (560):
  • SSL certificate problem: unable to get local issuer certificate
  • Closing connection 0
    curl: (60) SSL certificate problem: unable to get local issuer certificate
    More details here: https://curl.haxx.se/docs/sslcerts.html

And using the chrome exported certificate from the root level it fails at:

  • ALPN, offering h2
  • ALPN, offering http/1.1
  • successfully set certificate verify locations:
  • CAfile: /etc/ssl/certs/ca-certificates.crt
    CApath: /etc/ssl/certs
  • TLSv1.3 (OUT), TLS handshake, Client hello (1):
  • TLSv1.3 (IN), TLS handshake, Server hello (2):
  • TLSv1.2 (IN), TLS handshake, Certificate (11):
  • TLSv1.2 (IN), TLS handshake, Server key exchange (12):
  • TLSv1.2 (OUT), TLS alert, decrypt error (563):
  • error:0407008A:rsa routines:RSA_padding_check_PKCS1_type_1:invalid padding
  • Closing connection 0
    curl: (35) error:0407008A:rsa routines:RSA_padding_check_PKCS1_type_1:invalid padding

So how do I convert let's encrypt certificated properly? The example.key.DER was produced using the following command:
openssl rsa -in privkey.pem -outform DER -out example.key.DER

ESP32 Module
ESP32 Dev Module breakout board, no RAM addon or anything fancy

Software (please complete the following information if applicable)

  • IDE and Version: Arduino 1.8.12
  • OS: Ubuntu 20.4
  • Client used to access the server: curl 7.68.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions