aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-08-01 12:27:41 +0200
committerChristian Schneppe <christian@pix-art.de>2017-08-01 12:27:41 +0200
commit0f34c0ab3ed0ce3c98dc4d835c7897e8d533f7e6 (patch)
tree0d7e9e08dbf5a006504f647d6881e3cd53503882 /src/main
parent123ab597690fdcd04fac31b25001d144e0c6d6af (diff)
use CN-workaround for pre-kitkat
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/de/pixart/messenger/crypto/XmppDomainVerifier.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main/java/de/pixart/messenger/crypto/XmppDomainVerifier.java b/src/main/java/de/pixart/messenger/crypto/XmppDomainVerifier.java
index b53b6072b..97b3733b6 100644
--- a/src/main/java/de/pixart/messenger/crypto/XmppDomainVerifier.java
+++ b/src/main/java/de/pixart/messenger/crypto/XmppDomainVerifier.java
@@ -1,5 +1,6 @@
package de.pixart.messenger.crypto;
+import android.os.Build;
import android.util.Log;
import android.util.Pair;
@@ -42,9 +43,10 @@ public class XmppDomainVerifier implements DomainHostnameVerifier {
}
X509Certificate certificate = (X509Certificate) chain[0];
final List<String> commonNames = getCommonNames(certificate);
- if (isSelfSigned(certificate)) {
+ final boolean isSelfSignedCertificate = isSelfSigned(certificate);
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT || isSelfSignedCertificate) {
if (commonNames.size() == 1 && commonNames.get(0).equals(domain)) {
- Log.d(LOGTAG, "accepted CN in cert self signed cert for " + domain);
+ Log.d(LOGTAG, "accepted CN in cert as work around for " + domain + " isSelfSigned=" + Boolean.toString(isSelfSignedCertificate) + ", sdkInt=" + Build.VERSION.SDK_INT);
return true;
}
}