espressif / esp-protocols

Collection of ESP-IDF components related to networking protocols
181 stars 126 forks source link

feat(websocket): Support DS peripheral for mutual TLS (IDFGH-12285) #520

Open johanstokking opened 7 months ago

johanstokking commented 7 months ago

Fantastic project guys. Here's something I use that you might want to take into consideration: supporting the DS peripheral for mutual TLS.

Example usage with https://github.com/espressif/esp_secure_cert_mgr/:

    char *client_cert = NULL;
    uint32_t client_cert_len = 0;
    esp_err_t ret = esp_secure_cert_get_device_cert(&client_cert, &client_cert_len);
    assert(esp_ret == ESP_OK);

    esp_ds_data_ctx_t *ds_data = esp_secure_cert_get_ds_ctx();
    assert(ds_data != NULL);

    esp_websocket_client_config_t config = {
        .uri = "wss://echo.websocket.org",
        .client_cert = client_cert, /* in this example it's PEM so client_cert_len is not set */
        .client_ds_data = ds_data,
        .crt_bundle_attach = esp_crt_bundle_attach,
    };

I considered adding this to the example project, but I feel like it gets bloated quickly with dependencies and ifdefs.

CLAassistant commented 7 months ago

CLA assistant check
All committers have signed the CLA.

johanstokking commented 3 months ago

@gabsuren Can you shed some light on this? Thanks!

gabsuren commented 2 months ago

@gabsuren Can you shed some light on this? Thanks!

Sorry for the late response, it's on the line with https://github.com/espressif/esp-protocols/pull/621