typedef struct {
gchar *ca_cert;
gchar *private_key;
+ gchar *private_key_password;
gchar *client_cert;
gchar *anonymous_identity;
gchar *identity;
#define WIFI_CONFIG_EAP_CACERT "CACertFile"
#define WIFI_CONFIG_EAP_CLIENTCERT "ClientCertFile"
#define WIFI_CONFIG_EAP_PRIVATEKEY "PrivateKeyFile"
+#define WIFI_CONFIG_EAP_PRIVATEKEY_PASSWORD "PrivateKeyPassword"
#define WIFI_CONFIG_EAP_IDENTITY "Identity"
#define WIFI_CONFIG_EAP_TYPE "EapType"
#define WIFI_CONFIG_EAP_AUTH_TYPE "EapAuthType"
typedef struct {
gchar *ca_cert;
gchar *private_key;
+ gchar *private_key_password;
gchar *client_cert;
gchar *anonymous_identity;
gchar *identity;
g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_CLIENTCERT, g_variant_new_string(eap_config->client_cert));
if (eap_config->private_key != NULL)
g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_PRIVATEKEY, g_variant_new_string(eap_config->private_key));
+ if (eap_config->private_key_password != NULL)
+ g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_PRIVATEKEY_PASSWORD, g_variant_new_string(eap_config->private_key_password));
if (eap_config->identity != NULL)
g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_IDENTITY, g_variant_new_string(eap_config->identity));
if (eap_config->subject_match != NULL)
return WIFI_MANAGER_ERROR_NONE;
}
+EXPORT_API int wifi_manager_config_set_eap_private_key_info(wifi_manager_config_h config,
+ const char *file, const char *password)
+{
+ __NETWORK_CAPI_FUNC_ENTER__;
+
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
+ wifi_config_s *h = (wifi_config_s *)config;
+
+ if (_wifi_check_config_validity(config) == false || h->eap_config == NULL) {
+ WIFI_LOG(WIFI_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE
+ __NETWORK_CAPI_FUNC_EXIT__; //LCOV_EXCL_LINE
+ return WIFI_MANAGER_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
+ }
+
+ h->eap_config->private_key = g_strdup(file);
+ h->eap_config->private_key_password = g_strdup(password);
+
+ __NETWORK_CAPI_FUNC_EXIT__;
+
+ return WIFI_MANAGER_ERROR_NONE;
+}
+
EXPORT_API int wifi_manager_config_get_eap_identity(wifi_manager_config_h config, char **identity)
{
__NETWORK_CAPI_FUNC_ENTER__;
char anonymous[100] = { 0, };
char ca_cert[100] = { 0, };
char private_key[100] = { 0, };
+ char private_key_password[100] = { 0, };
char client_cert[100] = { 0, };
char eap_identity[100] = { 0, };
int eap_type;
rv = wifi_manager_config_set_eap_type(config, eap_type);
if (rv != WIFI_MANAGER_ERROR_NONE)
return -1;
+
+ if (eap_type == 1) {
+ if (test_get_user_string("EAP private key file - ", private_key, 99) &&
+ test_get_user_string("EAP private-key password - ", private_key_password, 99)) {
+ rv = wifi_manager_config_set_eap_private_key_info(config, private_key, private_key_password);
+ if (rv != WIFI_MANAGER_ERROR_NONE)
+ return -1;
+ }
+ }
}
if (test_get_user_int("EAP auth type (None(0), PAP(1), MSCHAP(2), MSCHAPv2(3), GTC(4), MD5(5)) - (Enter for skip): ", &eap_auth_type)) {