Forum: Mikrocontroller und Digitale Elektronik Letsencrypt auf ESP32


von Hase (Gast)


Lesenswert?

Hi,

evtl. bin ich auch nur unfähig zu Googlen ^^

aber hat schonmal jemand SSL-Zertifikate für eine Verschlüsselte 
Kommunikations durchs Internet auf einem ESP32 zu laufen gebracht?
Am coolsten wäre ja sowas wie LetsEncrypt.

Evtl. hat ja jemand Ideen für mich :)

Danke & Grüße

von Igel (Gast)


Lesenswert?

Hase schrieb:
> ... wie LetsEncrypt

Meinst du vielleicht Zertifikate von *Let’s* Encrypt?

https://letsencrypt.org/

von Hase (Gast)


Lesenswert?

Ja, nein...

ich meine die Einbindung der Zertifikate in den HTTPs-Server auf dem 
ESP32

von Bastler (Gast)


Lesenswert?

Hase schrieb:
> Ja, nein...
>
> ich meine die Einbindung der Zertifikate in den HTTPs-Server auf dem
> ESP32

Geht nicht so, wie bei einem "normalen" Webserver, d.h. Zertifikate im 
Filesystem ablegen.

Das Zertifikat muss mit in den Sourcecode eingebunden werden und dann 
alles übersetzten, siehe auch
https://github.com/fhessel/esp32_https_server/blob/master/extras/README.md

von Εrnst B. (ernst)


Lesenswert?

Bastler schrieb:
> Geht nicht so, wie bei einem "normalen" Webserver, d.h. Zertifikate im
> Filesystem ablegen.

Warum nicht?

Du brauchst ja nur ein "SSLCert"-Objekt richtig zu initialisieren. Und 
das geht aus zwei char* mit Längenangabe.
1
class SSLCert {
2
public:
3
  /**
4
   * \brief Creates a new SSLCert.
5
   * 
6
   * The certificate and key data may be NULL (default values) if the certificate is meant
7
   * to be passed to createSelfSignedCert().
8
   * 
9
   * Otherwise, the data must reside in a memory location that is not deleted until the server
10
   * using the certificate is stopped.
11
   * 
12
   * \param[in] certData The certificate data to use (DER format)
13
   * \param[in] certLength The length of the certificate data
14
   * \param[in] pkData The private key data to use (DER format)
15
   * \param[in] pkLength The length of the private key
16
   */
17
  SSLCert(
18
    unsigned char * certData = NULL,
19
    uint16_t certLength = 0,
20
    unsigned char * pkData = NULL,
21
    uint16_t pkLength = 0
22
  );
23
...

d.H. garkein Problem, das aus Dateien zu lesen, solang du den Lesebuffer 
nicht zu früh freigibst: ("the data must reside in a memory location 
that is not deleted")

Nur vorher umwandeln in's DER-Format, direkt mit X509 - Ascii-Encoded 
files kommt er nicht klar.
1
openssl rsa -in example.key -outform DER -out example.key.DER
2
openssl x509 -in example.crt -outform DER -out example.crt.DER

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.