How can I use a PEM that expires in 12 months in an embedded product?
Posted: Tue Oct 15, 2024 8:27 am
I apologise in advance if this is a dumb question. I feel like I must be missing something.
The HTTP_CLIENT example program
https://github.com/espressif/esp-idf/tr ... ttp_client
Uses a PEM file to make an HTTPS request.
I read that I can generate a PEM file using a script like this (substitute websocket.org with the appropriate domain)
echo "" | openssl s_client -showcerts -connect websocket.org:443 | sed -n "1,/Root/d; /BEGIN/,/END/p" | openssl x509 -outform PEM >websocket_org.pem
However when I do that and inspect the PEM file I see that it has an expiry date - that varies from site to site but is typically 12 months.
What happens after the expiry date? Does it stop working?
I feel I must be missing something because this mechanism is presumably used for secure OTA upgrades. If the PEM for your server expires then you can no longer upgrade the product.
This problem is doubly annoying because I do not actually need a secure connection - it works fine if I compile with ESP_TLS_INSECURE and ESP_TLS_SKIP_SERVER_VERIFY - but if these are not set then I must supply a cert_pem in the HTTP_CLIENT config. And that implies it will expire.
Martin
The HTTP_CLIENT example program
https://github.com/espressif/esp-idf/tr ... ttp_client
Uses a PEM file to make an HTTPS request.
I read that I can generate a PEM file using a script like this (substitute websocket.org with the appropriate domain)
echo "" | openssl s_client -showcerts -connect websocket.org:443 | sed -n "1,/Root/d; /BEGIN/,/END/p" | openssl x509 -outform PEM >websocket_org.pem
However when I do that and inspect the PEM file I see that it has an expiry date - that varies from site to site but is typically 12 months.
What happens after the expiry date? Does it stop working?
I feel I must be missing something because this mechanism is presumably used for secure OTA upgrades. If the PEM for your server expires then you can no longer upgrade the product.
This problem is doubly annoying because I do not actually need a secure connection - it works fine if I compile with ESP_TLS_INSECURE and ESP_TLS_SKIP_SERVER_VERIFY - but if these are not set then I must supply a cert_pem in the HTTP_CLIENT config. And that implies it will expire.
Martin