Websocket with SSL fail

Tommie
Posts: 1
Joined: Fri Jul 19, 2024 12:18 pm

Websocket with SSL fail

Postby Tommie » 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:
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
The actual URL in idf.py menuconfig:
websocket URL.png
websocket URL.png (6.69 KiB) Viewed 506 times
I put the actual PEM file in the websocket_app_start procedure:
  1.     const char websocket_org_pem_start[] = \
  2.     "-----BEGIN CERTIFICATE-----\n" \
  3.     "MIIE+TCCA+GgAwIBAgISA5JHCZMbkLPiD3/sl/qt+6HwMA0GCSqGSIb3DQEBCwUA\n" \
  4.     "MDIxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MQswCQYDVQQD\n" \
  5.     "EwJSMzAeFw0yNDA1MjMwMTE3MTlaFw0yNDA4MjEwMTE3MThaMCAxHjAcBgNVBAMT\n" \
  6.     "FWVjaG8ud2Vic29ja2V0LmV2ZW50czCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC\n" \
  7.     "AQoCggEBANQ63WqRkq0zUCRhwUE2ce1Ld9l2MubA7MfPbO8o1OhLoMF1QwT4or7Q\n" \
  8.     "3MnofDDfKPl3pjIZjEFPAEv0xV6l/wvzhXnX5VCTW2u2aIXSQ/kGI+/59BreysoB\n" \
  9.     "ljlkvk5N2/mY+v5oCFczDmtZl7Vuu+IvAx1U3DwTDPQklcdvmnLnLIiZU8ach9ML\n" \
  10.     "Pd+mBdotSdiluYVZW8vOfhDaZ2/Z4icP4V4D4DdjZxIR96XJm2GZGP6UofftG8QZ\n" \
  11.     "5ZY+h49PtlnMeVdRH7kk5qq30hpymlAN88Nd4wCAzKMRuSxklwHnBIhNoXYMU9+n\n" \
  12.     "Dbcb1avyMqJEL5naFfNgBQ5K0MKHrrUCAwEAAaOCAhkwggIVMA4GA1UdDwEB/wQE\n" \
  13.     "AwIFoDAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDAYDVR0TAQH/BAIw\n" \
  14.     "ADAdBgNVHQ4EFgQUlJg+dmh+xqMpc/OwyWv+GPTQOCYwHwYDVR0jBBgwFoAUFC6z\n" \
  15.     "F7dYVsuuUAlA5h+vnYsUwsYwVQYIKwYBBQUHAQEESTBHMCEGCCsGAQUFBzABhhVo\n" \
  16.     "dHRwOi8vcjMuby5sZW5jci5vcmcwIgYIKwYBBQUHMAKGFmh0dHA6Ly9yMy5pLmxl\n" \
  17.     "bmNyLm9yZy8wIAYDVR0RBBkwF4IVZWNoby53ZWJzb2NrZXQuZXZlbnRzMBMGA1Ud\n" \
  18.     "IAQMMAowCAYGZ4EMAQIBMIIBBgYKKwYBBAHWeQIEAgSB9wSB9ADyAHcA7s3QZNXb\n" \
  19.     "Gs7FXLedtM0TojKHRny87N7DUUhZRnEftZsAAAGPoz0Q7AAABAMASDBGAiEA3bWN\n" \
  20.     "i5yD+xwRpWX63rhBqZJPPrS6ysV0XRJuIP0/5pMCIQDi3/MbCVJLdhSa737OgBT2\n" \
  21.     "WXciMZT7FOmF94/9yXW07gB3ABmYEHEJ8NZSLjCA0p4/ZLuDbijM+Q9Sju7fzko/\n" \
  22.     "FrTKAAABj6M9E5wAAAQDAEgwRgIhAI4CUdMFw+PG7fPWfRBBNoQIPxCHBY2oUDLv\n" \
  23.     "I2/nVdGhAiEA4LR65pqh1S57CZYqlyB2kmqB9KoJCROrpBv8fxa8EGgwDQYJKoZI\n" \
  24.     "hvcNAQELBQADggEBABnGMvoUujLD4M5SivkVRmwLSt+SKUk8FQQMAvk66jYNH4gV\n" \
  25.     "IuA5NuxyO19m3W2lYf6QzVm2fW1scPC//bEgOIHfHWRYOs/rGVyJ16QSZDHCi3Dn\n" \
  26.     "xPoDwJp8VrJwzTzr2ayJTY+5Srv5kC9hrRrLWqQuel1Hu3qEZKKZeyZZXE/FXh9P\n" \
  27.     "vMuqfWaaVfcKT5gnerFmrg3jX+OrRc6zb0K9nPeM6PLuDavcUDsTJmdLYRa7Bse5\n" \
  28.     "VgiwfNtEVw9yvmL9HNIHo7RImuvA3VTI6l03b8EFJ6dAE6MGBkXfmIQKzMLQVeL0\n" \
  29.     "CLu6rGehhdQFdkSXXbvlbP+M6qI3AxicGwikDiQ=\n" \
  30.     "-----END CERTIFICATE-----\n";
  31.  
  32.     esp_websocket_client_config_t websocket_cfg = {
  33.         .uri = "wss://echo.websocket.events",
  34.         .cert_pem = (const char *)websocket_org_pem_start,
  35.     };
What am I doing wrong?
Thanks in advance!

Who is online

Users browsing this forum: No registered users and 85 guests