2016-11-11 02:38:57 +00:00
|
|
|
#ifndef ESP_WPA2_H
|
|
|
|
#define ESP_WPA2_H
|
|
|
|
|
|
|
|
#include "esp_err.h"
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Set wpa2 enterprise authentication.
|
|
|
|
*
|
|
|
|
* @attention wpa2 enterprise authentication can only be used when ESP8266 station is enabled.
|
|
|
|
* wpa2 enterprise authentication can only support PEAP-MSCHAPv2 and TTLS-MSCHAPv2 method.
|
|
|
|
*
|
|
|
|
* @param enable
|
|
|
|
* - 1: enable wpa2 enterprise authentication;
|
|
|
|
* - 0: disable wpa2 enterprise authentication
|
|
|
|
*
|
|
|
|
* @return 0: succeed
|
|
|
|
-1: fail
|
|
|
|
*/
|
2016-11-21 06:17:52 +00:00
|
|
|
esp_err_t esp_wifi_sta_set_wpa2_enterprise_auth(int enable);
|
2016-11-11 02:38:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Set username for PEAP/TTLS method.
|
|
|
|
*
|
|
|
|
* @param username: point to address where stores the username;
|
|
|
|
* len: length of username, limited to 1~127
|
|
|
|
*
|
|
|
|
* @return 0: succeed
|
|
|
|
* -1: fail(len <= 0 or len >= 128)
|
|
|
|
* -2: fail(internal memory malloc fail)
|
|
|
|
*/
|
2016-11-21 06:17:52 +00:00
|
|
|
esp_err_t esp_wifi_sta_set_enterprise_username(unsigned char *username, int len);
|
2016-11-11 02:38:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Set password for PEAP/TTLS method..
|
|
|
|
*
|
|
|
|
* @param password: point to address where stores the password;
|
|
|
|
* len: length of password
|
|
|
|
*
|
|
|
|
* @return 0: succeed
|
|
|
|
* -1: fail(len <= 0)
|
|
|
|
* -2: fail(internal memory malloc fail)
|
|
|
|
*/
|
2016-11-21 06:17:52 +00:00
|
|
|
esp_err_t esp_wifi_sta_set_enterprise_password(unsigned char *password, int len);
|
2016-11-11 02:38:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Set CA certificate for PEAP/TTLS method.
|
|
|
|
*
|
|
|
|
* @param ca_cert: point to address where stores the CA certificate;
|
|
|
|
* len: length of ca_cert
|
|
|
|
*
|
|
|
|
* @return 0: succeed
|
|
|
|
*/
|
2016-11-21 06:17:52 +00:00
|
|
|
esp_err_t esp_wifi_sta_set_enterprise_ca_cert(unsigned char *ca_cert, int len);
|
2016-11-11 02:38:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Clear username for PEAP/TTLS method.
|
|
|
|
*
|
|
|
|
* @param null
|
|
|
|
*
|
|
|
|
* @return null
|
|
|
|
*/
|
2016-11-21 06:17:52 +00:00
|
|
|
void esp_wifi_sta_clear_enterprise_username(void);
|
2016-11-11 02:38:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Clear password for PEAP/TTLS method..
|
|
|
|
*
|
|
|
|
* @param null
|
|
|
|
*
|
|
|
|
* @return null
|
|
|
|
*/
|
2016-11-21 06:17:52 +00:00
|
|
|
void esp_wifi_sta_clear_enterprise_password(void);
|
2016-11-11 02:38:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Clear CA certificate for PEAP/TTLS method.
|
|
|
|
*
|
|
|
|
* @param null
|
|
|
|
*
|
|
|
|
* @return null
|
|
|
|
*/
|
2016-11-21 06:17:52 +00:00
|
|
|
void esp_wifi_sta_clear_enterprise_ca_cert(void);
|
2016-11-11 02:38:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Set client certificate and key.
|
|
|
|
*
|
|
|
|
* @param client_cert: point to address where stores the client certificate;
|
|
|
|
* client_cert_len: length of client certificate;
|
|
|
|
* private_key: point to address where stores the private key;
|
|
|
|
* private_key_len: length of private key;
|
|
|
|
* private_key_password: point to address where stores the private key password;
|
|
|
|
* private_key_password_len: length of private key password;
|
|
|
|
*
|
|
|
|
* @return 0: succeed
|
|
|
|
*/
|
2016-11-21 06:17:52 +00:00
|
|
|
esp_err_t esp_wifi_sta_set_enterprise_cert_key(unsigned char *client_cert, int client_cert_len, unsigned char *private_key, int private_key_len, unsigned char *private_key_passwd, int private_key_passwd_len);
|
2016-11-11 02:38:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Clear client certificate and key.
|
|
|
|
*
|
|
|
|
* @param null
|
|
|
|
*
|
|
|
|
* @return null
|
|
|
|
*/
|
2016-11-21 06:17:52 +00:00
|
|
|
void esp_wifi_sta_clear_enterprise_cert_key(void);
|
2016-11-11 02:38:57 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|