Websocket with SSL fail
Posted: Fri Jul 19, 2024 1:34 pm
Hi all!
I use the ESP-IDF (v4.4.8) extension in VSCode.
I can successfully run the "websocket" example project on my ESP-WROOM-32 module. However, with SSL mode I get an error:
What am I doing wrong?
Thanks in advance!
I use the ESP-IDF (v4.4.8) extension in VSCode.
I can successfully run the "websocket" example project on my ESP-WROOM-32 module. However, with SSL mode I get an error:
The actual URL in idf.py menuconfig: I put the actual PEM file in the websocket_app_start procedure:E (5426) esp-tls-mbedtls: mbedtls_ssl_handshake returned -0x2700
I (5426) esp-tls-mbedtls: Failed to verify peer certificate!
E (5426) esp-tls: Failed to open new connection
- const char websocket_org_pem_start[] = \
- "-----BEGIN CERTIFICATE-----\n" \
- "MIIE+TCCA+GgAwIBAgISA5JHCZMbkLPiD3/sl/qt+6HwMA0GCSqGSIb3DQEBCwUA\n" \
- "MDIxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MQswCQYDVQQD\n" \
- "EwJSMzAeFw0yNDA1MjMwMTE3MTlaFw0yNDA4MjEwMTE3MThaMCAxHjAcBgNVBAMT\n" \
- "FWVjaG8ud2Vic29ja2V0LmV2ZW50czCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC\n" \
- "AQoCggEBANQ63WqRkq0zUCRhwUE2ce1Ld9l2MubA7MfPbO8o1OhLoMF1QwT4or7Q\n" \
- "3MnofDDfKPl3pjIZjEFPAEv0xV6l/wvzhXnX5VCTW2u2aIXSQ/kGI+/59BreysoB\n" \
- "ljlkvk5N2/mY+v5oCFczDmtZl7Vuu+IvAx1U3DwTDPQklcdvmnLnLIiZU8ach9ML\n" \
- "Pd+mBdotSdiluYVZW8vOfhDaZ2/Z4icP4V4D4DdjZxIR96XJm2GZGP6UofftG8QZ\n" \
- "5ZY+h49PtlnMeVdRH7kk5qq30hpymlAN88Nd4wCAzKMRuSxklwHnBIhNoXYMU9+n\n" \
- "Dbcb1avyMqJEL5naFfNgBQ5K0MKHrrUCAwEAA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X+OrRc6zb0K9nPeM6PLuDavcUDsTJmdLYRa7Bse5\n" \
- "VgiwfNtEVw9yvmL9HNIHo7RImuvA3VTI6l03b8EFJ6dAE6MGBkXfmIQKzMLQVeL0\n" \
- "CLu6rGehhdQFdkSXXbvlbP+M6qI3AxicGwikDiQ=\n" \
- "-----END CERTIFICATE-----\n";
- esp_websocket_client_config_t websocket_cfg = {
- .uri = "wss://echo.websocket.events",
- .cert_pem = (const char *)websocket_org_pem_start,
- };
Thanks in advance!