Commit 2c896498 authored by Toni Beier's avatar Toni Beier

Add explanatory comments to ca certificates detection code

parent cd56ba77
Pipeline #22927 passed with stages
in 3 minutes and 58 seconds
...@@ -648,10 +648,17 @@ class Helper { ...@@ -648,10 +648,17 @@ class Helper {
} }
list.add(new MainActivity.TickLine(ticked, message, "EAP Methode", true)); list.add(new MainActivity.TickLine(ticked, message, "EAP Methode", true));
// WifiManager::getConfiguredNetworks return WifiConfiguration instances with incomplete information
// There is no right way to verify the CA certificate in a configured WLAN.
// Transforms WifiEnterpriseConfig instance to string value and check the ca_cert value
Map<String, String> currentWifiConfigurationValues = new HashMap<>(); Map<String, String> currentWifiConfigurationValues = new HashMap<>();
// Parse string representation of enterprise config
for (String wifiConfigurationLine : currentConfig.enterpriseConfig.toString().split(String.valueOf('\n'))) { for (String wifiConfigurationLine : currentConfig.enterpriseConfig.toString().split(String.valueOf('\n'))) {
String wifiConfigurationValueIdentifier = null; String wifiConfigurationValueIdentifier = null;
String wifiConfigurationValue = null; String wifiConfigurationValue = null;
// Check if identifier has value and add identifier and maybe value to a map
String[] wifiConfigurationLineSegments = wifiConfigurationLine.split(String.valueOf(' ')); String[] wifiConfigurationLineSegments = wifiConfigurationLine.split(String.valueOf(' '));
if (wifiConfigurationLineSegments.length >= 1) { if (wifiConfigurationLineSegments.length >= 1) {
wifiConfigurationValueIdentifier = wifiConfigurationLineSegments[0]; wifiConfigurationValueIdentifier = wifiConfigurationLineSegments[0];
...@@ -661,13 +668,13 @@ class Helper { ...@@ -661,13 +668,13 @@ class Helper {
currentWifiConfigurationValues.put(wifiConfigurationValueIdentifier, wifiConfigurationValue); currentWifiConfigurationValues.put(wifiConfigurationValueIdentifier, wifiConfigurationValue);
} }
} }
// If ca_cert is in map/string, then check value.
String currentWifiConfigurationCaCertValue = currentWifiConfigurationValues.get("ca_cert"); String currentWifiConfigurationCaCertValue = currentWifiConfigurationValues.get("ca_cert");
if (currentWifiConfigurationCaCertValue != null) { if (currentWifiConfigurationCaCertValue != null) {
if ( currentWifiConfigurationCaCertValue.contains("PEAP") && currentWifiConfigurationCaCertValue.contains("eduroam") if ( currentWifiConfigurationCaCertValue.contains("PEAP") && currentWifiConfigurationCaCertValue.contains("eduroam")
&& currentWifiConfigurationCaCertValue.contains("EAPIEEE8021X") && currentWifiConfigurationCaCertValue.contains("PEAP")) { && currentWifiConfigurationCaCertValue.contains("EAPIEEE8021X") && currentWifiConfigurationCaCertValue.contains("PEAP")) {
message = context.getString(R.string.tickline_subtext_ca_cert_certificate_ok); message = context.getString(R.string.tickline_subtext_ca_cert_certificate_ok);
ticked = true; ticked = true;
} else { } else {
message = context.getString(R.string.tickline_subtext_ca_cert_certificate_wrong); message = context.getString(R.string.tickline_subtext_ca_cert_certificate_wrong);
ticked = false; ticked = false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment