WAP/WPA2-PSK (AES vs TKIP) with IDF 4.2.2

formus14
Posts: 8
Joined: Wed Nov 15, 2017 3:22 pm

WAP/WPA2-PSK (AES vs TKIP) with IDF 4.2.2

Postby formus14 » Mon Jul 26, 2021 12:32 pm

Hi,

Quick question, I ran an example code of a wifi ap mode configured with WAP/WPA2-PSK authentication ..

But unfortunately, it seems like by default IDF uses TKIP for encryption instead of AES which is preferred for security reasons!

The question is, with the mention IDF v4.2.2 ( https://github.com/espressif/esp-idf/tree/v4.2.2 ); is it still possible to use AES instead of TKIP? what adjustment needs to be done on the code below ?

Code: Select all

void wifi_init_softap(void)
{
    ESP_ERROR_CHECK(esp_netif_init());
    ESP_ERROR_CHECK(esp_event_loop_create_default());
    esp_netif_create_default_wifi_ap();

    wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
    ESP_ERROR_CHECK(esp_wifi_init(&cfg));

    ESP_ERROR_CHECK(esp_event_handler_instance_register(WIFI_EVENT,
                                                        ESP_EVENT_ANY_ID,
                                                        &wifi_event_handler,
                                                        NULL,
                                                        NULL));

    wifi_config_t wifi_config = {
        .ap = {
            .ssid = EXAMPLE_ESP_WIFI_SSID,
            .ssid_len = strlen(EXAMPLE_ESP_WIFI_SSID),
            .channel = EXAMPLE_ESP_WIFI_CHANNEL,
            .password = EXAMPLE_ESP_WIFI_PASS,
            .max_connection = EXAMPLE_MAX_STA_CONN,
            .authmode = WIFI_AUTH_WPA_WPA2_PSK
        },
    };
    if (strlen(EXAMPLE_ESP_WIFI_PASS) == 0) {
        wifi_config.ap.authmode = WIFI_AUTH_OPEN;
    }

    ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_AP));
    ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_AP, &wifi_config));
    ESP_ERROR_CHECK(esp_wifi_start());

    ESP_LOGI(TAG, "wifi_init_softap finished. SSID:%s password:%s channel:%d",
             EXAMPLE_ESP_WIFI_SSID, EXAMPLE_ESP_WIFI_PASS, EXAMPLE_ESP_WIFI_CHANNEL);
}
Thanks!

Who is online

Users browsing this forum: FrancoisB-HEX and 130 guests