Commit 9c3e7a29 authored by Toni Beier's avatar Toni Beier

Merge branch 'map_based_ca_certificate_detection' into 'master'

CA certificate detection use map

See merge request !15
parents 512421fd ab9f5a46
Pipeline #22948 failed with stages
in 8 minutes and 19 seconds
...@@ -47,9 +47,11 @@ import java.security.cert.CertificateException; ...@@ -47,9 +47,11 @@ import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory; import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate; import java.security.cert.X509Certificate;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.stream.Stream;
class Helper { class Helper {
...@@ -646,26 +648,31 @@ class Helper { ...@@ -646,26 +648,31 @@ class Helper {
} }
list.add(new MainActivity.TickLine(ticked, message, "EAP Methode", true)); list.add(new MainActivity.TickLine(ticked, message, "EAP Methode", true));
Map<String, String> currentWifiConfigurationValues = new HashMap<>();
int nullpoint; for (String wifiConfigurationLine : currentConfig.enterpriseConfig.toString().split(String.valueOf('\n'))) {
nullpoint=currentConfig.enterpriseConfig.toString().indexOf("ca_cert NULL"); String wifiConfigurationValueIdentifier = null;
if (nullpoint==-1){ String wifiConfigurationValue = null;
int start,finish; String[] wifiConfigurationLineSegments = wifiConfigurationLine.split(String.valueOf(' '));
start=currentConfig.enterpriseConfig.toString().indexOf("ca_cert"); if (wifiConfigurationLineSegments.length >= 1) {
finish=currentConfig.enterpriseConfig.toString().indexOf("\"", start+10); wifiConfigurationValueIdentifier = wifiConfigurationLineSegments[0];
if (start>0 && finish>0) { if (wifiConfigurationLineSegments.length >= 2) {
message="OK"; wifiConfigurationValue = wifiConfigurationLineSegments[1];
ticked = true; }
currentWifiConfigurationValues.put(wifiConfigurationValueIdentifier, wifiConfigurationValue);
} }
else }
{ if (currentWifiConfigurationValues.containsKey("ca_cert")) {
message="ERROR"; String currentWifiConfigurationCaCertValue = currentWifiConfigurationValues.get("ca_cert");
if (currentWifiConfigurationCaCertValue != null) {
message = "OK";
ticked = true;
} else {
message = "ERROR";
ticked = false; ticked = false;
} }
} } else {
else message = "Not found";
{
message="Not found";
ticked = false; ticked = false;
} }
list.add(new MainActivity.TickLine(ticked, message, "CA Certificate", true)); list.add(new MainActivity.TickLine(ticked, message, "CA Certificate", true));
......
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