summaryrefslogtreecommitdiff
path: root/app/src/release
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/release')
-rw-r--r--app/src/release/java/se/leap/bitmaskclient/ProviderAPI.java22
1 files changed, 13 insertions, 9 deletions
diff --git a/app/src/release/java/se/leap/bitmaskclient/ProviderAPI.java b/app/src/release/java/se/leap/bitmaskclient/ProviderAPI.java
index 9d0b4db6..8b8cabdf 100644
--- a/app/src/release/java/se/leap/bitmaskclient/ProviderAPI.java
+++ b/app/src/release/java/se/leap/bitmaskclient/ProviderAPI.java
@@ -547,15 +547,19 @@ public class ProviderAPI extends IntentService {
if(!ConfigHelper.checkErroneousDownload(cert_string)) {
X509Certificate certificate = ConfigHelper.parseX509CertificateFromString(cert_string);
try {
- JSONObject provider_json = new JSONObject(preferences.getString(Provider.KEY, ""));
- String fingerprint = provider_json.getString(Provider.CA_CERT_FINGERPRINT);
- String encoding = fingerprint.split(":")[0];
- String expected_fingerprint = fingerprint.split(":")[1];
- String real_fingerprint = base64toHex(Base64.encodeToString(
- MessageDigest.getInstance(encoding).digest(certificate.getEncoded()),
- Base64.DEFAULT));
-
- result = real_fingerprint.trim().equalsIgnoreCase(expected_fingerprint.trim());
+ if(certificate != null) {
+ JSONObject provider_json = new JSONObject(preferences.getString(Provider.KEY, ""));
+ String fingerprint = provider_json.getString(Provider.CA_CERT_FINGERPRINT);
+ String encoding = fingerprint.split(":")[0];
+ String expected_fingerprint = fingerprint.split(":")[1];
+ String real_fingerprint = base64toHex(Base64.encodeToString(
+ MessageDigest.getInstance(encoding).digest(certificate.getEncoded()),
+ Base64.DEFAULT));
+
+ result = real_fingerprint.trim().equalsIgnoreCase(expected_fingerprint.trim());
+ }
+ else
+ result = false;
} catch (JSONException e) {
result = false;
} catch (NoSuchAlgorithmException e) {