How to configure SoftAP with WPA2-PSK(AES) in non os sdk
-
- Posts: 2
- Joined: Tue Apr 02, 2019 5:34 pm
How to configure SoftAP with WPA2-PSK(AES) in non os sdk
Postby maverickchongo » Wed Oct 06, 2021 4:06 am
Hi,
Apple iOS is complaining about low security for my SoftAP which is using WPA2-PSK (TKIP), I believe it is because it is still using TKIP and I am trying to configure it with AES, the non-os-sdk documentation says that for the SoftAP AES is supported as well but I can't find any API to set it:
"ESP8266 softAP supports OPEN, WPAPSK, WPA2PSK; and encryption AUTO, TKIP, AES
are supported. But for the group key, only TKIP is supported."
Source:
https://www.espressif.com/sites/default ... nce_en.pdf
How can I configure it?
Ps. Migrating SDK is not an option for us right now.
Apple iOS is complaining about low security for my SoftAP which is using WPA2-PSK (TKIP), I believe it is because it is still using TKIP and I am trying to configure it with AES, the non-os-sdk documentation says that for the SoftAP AES is supported as well but I can't find any API to set it:
"ESP8266 softAP supports OPEN, WPAPSK, WPA2PSK; and encryption AUTO, TKIP, AES
are supported. But for the group key, only TKIP is supported."
Source:
https://www.espressif.com/sites/default ... nce_en.pdf
How can I configure it?
Ps. Migrating SDK is not an option for us right now.
-
- Posts: 2
- Joined: Tue Apr 02, 2019 5:34 pm
Re: How to configure SoftAP with WPA2-PSK(AES) in non os sdk
Postby maverickchongo » Fri Oct 08, 2021 5:08 pm
@Her Mary Correct, what I don't understand is why then the sdk guide says AES is supported for the soft AP?
Re: How to configure SoftAP with WPA2-PSK(AES) in non os sdk
Postby Her Mary » Tue Oct 19, 2021 3:09 pm
Maybe you should try RTOS instead: https://github.com/espressif/ESP8266_RT ... .c#L67-L71
-
- Posts: 195
- Joined: Sat Apr 01, 2017 1:21 am
- Contact:
Re: How to configure SoftAP with WPA2-PSK(AES) in non os sdk
Postby AgentSmithers » Thu Dec 09, 2021 5:14 pm
maverickchongo wrote:Hi,
Apple iOS is complaining about low security for my SoftAP which is using WPA2-PSK (TKIP), I believe it is because it is still using TKIP and I am trying to configure it with AES, the non-os-sdk documentation says that for the SoftAP AES is supported as well but I can't find any API to set it:
"ESP8266 softAP supports OPEN, WPAPSK, WPA2PSK; and encryption AUTO, TKIP, AES
are supported. But for the group key, only TKIP is supported."
Source:
https://www.espressif.com/sites/default ... nce_en.pdf
How can I configure it?
Ps. Migrating SDK is not an option for us right now.
This is what I use for my AccessPoint. I hope this points you in the correct direction
Code: Select all
#ifndef __accesspoint__
#define __accesspoint__
//#define WifiMemorySpaceSector 0x51
#define WifiMemorySpace 0x63000//0x51000 //Also defined in station.h, make sure they match!
struct Customflashconfig APFlashStationConf;
bool ICACHE_FLASH_ATTR reset_accessPoint()
{
os_printf("[%s][%s][%d]\r\n", __FILE__ ,__func__, __LINE__);
struct Customflashconfig Tempconfig;
Tempconfig.programmed=0;
SpiFlashOpResult SpiReturn = spi_flash_write(WifiMemorySpace+sizeof(APFlashStationConf),(uint32 *)&Tempconfig,sizeof(Tempconfig));
if (SpiReturn == SPI_FLASH_RESULT_OK)
{
os_printf("Accesspoint programmed=0\r\n");
}
else
{
os_printf("Failed to reset Accesspoint\r\n");
}
}
bool ICACHE_FLASH_ATTR isset_accessPoint()
{
os_printf("[%s][%s][%d]\r\n", __FILE__ ,__func__, __LINE__);
struct softap_config softapConfig;
spi_flash_read(WifiMemorySpace+sizeof(APFlashStationConf),(uint32 *)&APFlashStationConf,sizeof(APFlashStationConf));
if(APFlashStationConf.programmed==1)
{
return true;
}
else
{
return false;
}
}
/*
typedef enum _auth_mode {
AUTH_OPEN = 0,
AUTH_WEP,
AUTH_WPA_PSK,
AUTH_WPA2_PSK,
AUTH_WPA_WPA2_PSK
} AUTH_MODE;
*/
void ICACHE_FLASH_ATTR set_accessPoint(char * LSSID, char * LPassword, uint8 Lssid_len, AUTH_MODE Lauthmode, uint8 Lchannel, uint8 Lssid_hidden, uint8 Lmax_connection, uint16 Lbeacon_interval, char * LReserved)
{
os_printf("[%s][%s][%d]\r\n", __FILE__ ,__func__, __LINE__);
struct Customflashconfig Tempconfig;
os_memcpy(&Tempconfig.ssid, LSSID, 32);
os_memcpy(&Tempconfig.password, LPassword, 64);
Tempconfig.ssid_len=os_strlen(LSSID);
Tempconfig.authmode=Lauthmode;
Tempconfig.ssid_hidden=Lchannel;
Tempconfig.max_connection=Lmax_connection;
Tempconfig.beacon_interval=Lbeacon_interval;
wifi_softap_set_config(&Tempconfig);
Tempconfig.programmed=1;
//SpiFlashOpResult SpiReturn = spi_flash_erase_sector(WifiMemorySpaceSector);
SpiFlashOpResult SpiReturn = spi_flash_erase_sector(WifiMemorySpace/SPI_FLASH_SEC_SIZE);
if (SpiReturn == SPI_FLASH_RESULT_OK)
{
os_printf("SPI Flash Erase OK\r\n");
}
SpiReturn = spi_flash_write(WifiMemorySpace+sizeof(APFlashStationConf),(uint32 *)&Tempconfig,sizeof(Tempconfig));
if (SpiReturn == SPI_FLASH_RESULT_OK)
{
os_printf("SPI Flash Write OK\r\n");
}
os_printf("ssid: \"%s\"\npw: \"%s\"\nProgrammed: %d\r\n",Tempconfig.ssid,Tempconfig.password,Tempconfig.programmed);
}
void ICACHE_FLASH_ATTR reload_accesspoint()
{
os_printf("[%s][%s][%d]\r\n", __FILE__ ,__func__, __LINE__);
unload_accesspoint();
init_accesspoint();
}
void ICACHE_FLASH_ATTR unload_accesspoint()
{
os_printf("[%s][%s][%d]\r\n", __FILE__ ,__func__, __LINE__);
os_printf("[%s] wifi_get_opmode() = %d\r\n", __func__, wifi_get_opmode());
if ((wifi_get_opmode() & 2) == 2)
{
wifi_set_opmode_current(wifi_get_opmode() & ~2);
os_printf("AccessPoint Disabled wifi_get_opmode() = %d\r\n", wifi_get_opmode());
}
}
void dhcps_lease_test(void)
{
os_printf("[%s][%s][%d]\r\n", __FILE__ ,__func__, __LINE__);
struct ip_info info;
wifi_softap_dhcps_stop();
IP4_ADDR(&info.ip, 192, 168, 1, 1);
IP4_ADDR(&info.gw, 192, 168, 1, 1);
IP4_ADDR(&info.netmask, 255, 255, 255, 0);
wifi_set_ip_info(SOFTAP_IF, &info);
wifi_softap_dhcps_start();
struct dhcps_lease dhcp_lease;
IP4_ADDR(&dhcp_lease.start_ip, 192, 168, 1, 100);
IP4_ADDR(&dhcp_lease.end_ip, 192, 168, 1, 105);
wifi_softap_set_dhcps_lease(&dhcp_lease);
}
void ICACHE_FLASH_ATTR init_accesspoint(char * password, uint8 maxconnections)
{
os_printf("[%s][%s][%d]\r\n", __FILE__ ,__func__, __LINE__);
//Need to implement APSSID And Password
if ((wifi_get_opmode() & 2) != 2)
{
os_printf("Loading AccessPoint %d -> %d\r\n", wifi_get_opmode(), (wifi_get_opmode() | 2));
wifi_set_opmode_current(wifi_get_opmode() | 2);
dhcps_lease_test();
os_printf("AccessPoint Loaded %d\r\n", wifi_get_opmode());
struct softap_config softapConfig;
spi_flash_read(WifiMemorySpace+sizeof(APFlashStationConf),(uint32 *)&APFlashStationConf,sizeof(APFlashStationConf));
APFlashStationConf.ssid[31]=0;
APFlashStationConf.password[63]=0;
//wifi_set_opmode_current(WifiOpMode); //Need to add this to turn on AP
if(APFlashStationConf.programmed==1)
{
os_printf("Saved Information Found for AP!!\r\nssid: \"%s\"\npw: \"%s\"\n SizeOf(APFlashStationConf) = %d\r\n", APFlashStationConf.ssid, APFlashStationConf.password, sizeof(APFlashStationConf));
os_memcpy(&softapConfig.ssid, APFlashStationConf.ssid, 32);
os_memcpy(&softapConfig.password, APFlashStationConf.password, 64);
softapConfig.ssid_len=APFlashStationConf.ssid_len;
softapConfig.authmode=APFlashStationConf.authmode;
softapConfig.ssid_hidden=APFlashStationConf.ssid_hidden;
softapConfig.max_connection=APFlashStationConf.max_connection;
softapConfig.beacon_interval=APFlashStationConf.beacon_interval;
wifi_softap_set_config(&softapConfig);
}
else
{
os_printf("Saved Information Not Found for AP, Using Defaults!!\r\n");
//Set AP Settings
char APssid[32] = "ESP ";
char MACADDR[6];
wifi_get_macaddr(SOFTAP_IF, MACADDR);
char MACADDRFormatted[12];
os_sprintf(MACADDRFormatted,"%02x%02x%02x%02x%02x%02x", MACADDR[0], MACADDR[1], MACADDR[2], MACADDR[3], MACADDR[4], MACADDR[5]);
strcat(APssid, MACADDRFormatted);
//strcat(APssid, MAC2STR(bss_link->bssid))
//char APpassword[64] = "01234567"; //This should be defined by a function argument!!
char APpassword[64] = {0};
if (password != NULL)
{
softapConfig.authmode=AUTH_WPA_WPA2_PSK;
os_printf("Copying AP Password: %s\r\n", password);
os_strcpy(APpassword, password);
}
else
{
softapConfig.authmode=AUTH_OPEN;
os_printf("No AP Password specificied, Leaving AP Open\r\n");
}
os_memcpy(&softapConfig.ssid, APssid, 32);
//os_memcpy(&softapConfig.ssid, "bibo", 32);
os_memcpy(&softapConfig.password, APpassword, 64);
softapConfig.ssid_len=0;
softapConfig.ssid_hidden=0;
softapConfig.max_connection=maxconnections;
softapConfig.beacon_interval=100;
wifi_softap_set_config(&softapConfig);
os_printf("Access Point Up - %s!!\r\n", &softapConfig.ssid); //APssid
}
}
else
{
os_printf("AP Already Loaded");
}
}
#endif
Who is online
Users browsing this forum: No registered users and 235 guests
Login
Newbies Start Here
Are you new to ESP8266?
Unsure what to do?
Dunno where to start?
Start right here!
Latest SDK
Documentation
Complete listing of the official ESP8266 related documentation release by ESPRESSIF!
Must read here!
- All times are UTC+08:00
- Top
- Delete all board cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. We are the manufacturer of ESP8266EX.