From f743e54f2d761c742d99ac868705818616dcf74f Mon Sep 17 00:00:00 2001 From: Geremy Condra Date: Fri, 14 Sep 2012 16:43:52 -0700 Subject: [PATCH] Change verifyServerDomainAndCertificates to pass in a hostname. This is required for cert pinning. Change-Id: I16041f17e97d9ae592a2b809f6a8164268338d1b --- core/java/android/net/http/CertificateChainValidator.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/java/android/net/http/CertificateChainValidator.java b/core/java/android/net/http/CertificateChainValidator.java index 6ad8fe38c11f2..f66075d66b75a 100644 --- a/core/java/android/net/http/CertificateChainValidator.java +++ b/core/java/android/net/http/CertificateChainValidator.java @@ -168,7 +168,13 @@ public class CertificateChainValidator { } try { - SSLParametersImpl.getDefaultTrustManager().checkServerTrusted(chain, authType); + X509TrustManager x509TrustManager = SSLParametersImpl.getDefaultTrustManager(); + if (x509TrustManager instanceof TrustManagerImpl) { + TrustManagerImpl trustManager = (TrustManagerImpl) x509TrustManager; + trustManager.checkServerTrusted(chain, authType, domain); + } else { + x509TrustManager.checkServerTrusted(chain, authType); + } return null; // No errors. } catch (GeneralSecurityException e) { if (HttpLog.LOGV) {