Commit 04312185 authored by Daniel Schreiber's avatar Daniel Schreiber

Merge branch 'check_ca_cert_values_in_detection' into 'master'

Check ca cert values in detection

See merge request !16
parents 9c3e7a29 2c896498
Pipeline #22949 failed with stages
in 6 minutes and 3 seconds
......@@ -648,10 +648,17 @@ class Helper {
}
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<>();
// Parse string representation of enterprise config
for (String wifiConfigurationLine : currentConfig.enterpriseConfig.toString().split(String.valueOf('\n'))) {
String wifiConfigurationValueIdentifier = null;
String wifiConfigurationValue = null;
// Check if identifier has value and add identifier and maybe value to a map
String[] wifiConfigurationLineSegments = wifiConfigurationLine.split(String.valueOf(' '));
if (wifiConfigurationLineSegments.length >= 1) {
wifiConfigurationValueIdentifier = wifiConfigurationLineSegments[0];
......@@ -661,21 +668,22 @@ class Helper {
currentWifiConfigurationValues.put(wifiConfigurationValueIdentifier, wifiConfigurationValue);
}
}
if (currentWifiConfigurationValues.containsKey("ca_cert")) {
String currentWifiConfigurationCaCertValue = currentWifiConfigurationValues.get("ca_cert");
if (currentWifiConfigurationCaCertValue != null) {
message = "OK";
// If ca_cert is in map/string, then check value.
String currentWifiConfigurationCaCertValue = currentWifiConfigurationValues.get("ca_cert");
if (currentWifiConfigurationCaCertValue != null) {
if ( currentWifiConfigurationCaCertValue.contains("PEAP") && currentWifiConfigurationCaCertValue.contains("eduroam")
&& currentWifiConfigurationCaCertValue.contains("EAPIEEE8021X") && currentWifiConfigurationCaCertValue.contains("PEAP")) {
message = context.getString(R.string.tickline_subtext_ca_cert_certificate_ok);
ticked = true;
} else {
message = "ERROR";
message = context.getString(R.string.tickline_subtext_ca_cert_certificate_wrong);
ticked = false;
}
} else {
message = "Not found";
message = context.getString(R.string.tickline_subtext_ca_cert_certificate_not_found);
ticked = false;
}
list.add(new MainActivity.TickLine(ticked, message, "CA Certificate", true));
list.add(new MainActivity.TickLine(ticked, message, context.getString(R.string.tickline_message_ca_cert), true));
String subjectMatch;
......
......@@ -15,7 +15,10 @@
<string name="dlg_wifi_fix_title">Vorhandene Eduroam Konfiguration löschen</string>
<string name="dlg_wifi_fix_message">Sie werden jetzt zu den Android Einstellungen für WLAN weitergeleitet. Löschen Sie dort bitte die Konfiguration für das Netzwerk "eduroam".</string>
<string name="dlg_conntest_pie">Ab Android 9 kann der Verbindungstest leider nicht durchgeführt werden.</string>
<string name="tickline_message_ca_cert">CA-Zertifikat</string>
<string name="tickline_subtext_ca_cert_certificate_ok">OK</string>
<string name="tickline_subtext_ca_cert_certificate_not_found">Zertifikat nicht gefunden</string>
<string name="tickline_subtext_ca_cert_certificate_wrong">Falsches Zertifikat</string>
<plurals name="connect_to_internet_message">
<item quantity="one">Bitte stelle eine Internetverbindung mit einem WLAN oder über mobile Daten her.\nIn der TU Chemnitz kannst du das WLAN Netz %1$s verwenden.</item>
......
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