Page 1 of 1

Support for WPA2 EAP networks.

Posted: Thu Nov 07, 2019 8:22 pm
by chibill
I wanted to connect to a WPA2 EAP network (Eduroam) and found that micropython could not Because I was able to from C I knew I could write a new function into the network library to set up WPA EAP.

Right now my function is definitely a very dirty hack as I don't bother checking the types of the mp_objects I also don't know what sort of state information might be worth saving.

I will most the code for the function when I get home. While I would definitely not want to put that function into micropython as it stands it could start as a base for someone who knows their way around micropython's internals more.

Re: Support for WPA2 EAP networks.

Posted: Thu Nov 07, 2019 8:35 pm
by chibill

Code: Select all

//Set up EAP
STATIC mp_obj_t esp_seteap(mp_obj_t self_in,mp_obj_t username,mp_obj_t password){
    size_t Ilen;
    size_t Plen;
    const char *EAP_IDENTITY = mp_obj_str_get_data(username,&Ilen);
    const char *EAP_PASSWORD = mp_obj_str_get_data(password,&Plen);
    ESP_EXCEPTIONS(esp_wifi_sta_wpa2_ent_set_identity((uint8_t *)EAP_IDENTITY, strlen(EAP_IDENTITY)));
    ESP_EXCEPTIONS(esp_wifi_sta_wpa2_ent_set_username((uint8_t *)EAP_IDENTITY, strlen(EAP_IDENTITY)));
    //ESP_EXCEPTIONS(esp_wifi_sta_wpa2_ent_set_new_password((uint8_t *)EAP_PASSWORD, strlen(EAP_PASSWORD)));
    ESP_EXCEPTIONS(esp_wifi_sta_wpa2_ent_set_password((uint8_t *)EAP_PASSWORD, strlen(EAP_PASSWORD)));
    return mp_const_none;

STATIC MP_DEFINE_CONST_FUN_OBJ_3(esp_seteap_obj, esp_seteap);
then add

Code: Select all

{ MP_ROM_QSTR(MP_QSTR_seteap), MP_ROM_PTR(&esp_seteap_obj) },
to the wlan_if_locals_dict_table

It makes a new function that takes your username and password that are used for connecting. I am not sure exactly when you would call it to connect but I have had success calling it both before and after activating the interface but always before trying to connect.

Re: Support for WPA2 EAP networks.

Posted: Wed Feb 26, 2020 9:55 pm
by chibill
Want to bring attention back up to this. As adding PEAP support would help micropython be used in some academic environments more easily.

Also I would submit a PR but I don't know how to add the proper checks around the inputs yet.

Re: Support for WPA2 EAP networks.

Posted: Wed Oct 07, 2020 8:05 pm
We have a project in development that is now required to have WPA2-Enterprise encryption.
I see the Arduino, Pycom and CircuitPython have this ability.
Has anyone ever seen a library available for micropython?
This is required for most commercial networks and I would hope that micropython would including this connectivity.

Re: Support for WPA2 EAP networks.

Posted: Mon Dec 14, 2020 4:13 am
by chibill
Unfortunately no library exists. I was going to try and make a library using the new features that allow C modules to be compiled as libraries but unfortunately they can't use ESP IDF functions not defined in the one table. So your stuck with modifying Micropython itself.