Browse Source

Fix potential bug accepting invalid certificates in reader mode

master
Anthony Restaino 8 years ago
parent
commit
4b917992ba
  1. 13
      app/src/main/java/acr/browser/lightning/reading/SHelper.java

13
app/src/main/java/acr/browser/lightning/reading/SHelper.java

@ -28,6 +28,7 @@ import java.net.URLEncoder; @@ -28,6 +28,7 @@ import java.net.URLEncoder;
import java.security.SecureRandom;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.Date;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -417,11 +418,19 @@ class SHelper { @@ -417,11 +418,19 @@ class SHelper {
private static class DefaultTrustManager implements X509TrustManager {
@Override
public void checkClientTrusted(X509Certificate[] arg0, String arg1) throws CertificateException {
public void checkClientTrusted(X509Certificate[] certs, String arg1) throws CertificateException {
Date today = new Date();
for (X509Certificate certificate : certs) {
certificate.checkValidity(today);
}
}
@Override
public void checkServerTrusted(X509Certificate[] arg0, String arg1) throws CertificateException {
public void checkServerTrusted(X509Certificate[] certs, String arg1) throws CertificateException {
Date today = new Date();
for (X509Certificate certificate : certs) {
certificate.checkValidity(today);
}
}
@Override

Loading…
Cancel
Save