Merge "Implement checkClientTrusted" am: 8e19803a6a
am: a4a6cf9b51
* commit 'a4a6cf9b51e903087e2c7f77f2dcb814a0b43fb8':
Implement checkClientTrusted
This commit is contained in:
@@ -65,7 +65,7 @@ public class NetworkSecurityTrustManager implements X509TrustManager {
|
|||||||
@Override
|
@Override
|
||||||
public void checkClientTrusted(X509Certificate[] chain, String authType)
|
public void checkClientTrusted(X509Certificate[] chain, String authType)
|
||||||
throws CertificateException {
|
throws CertificateException {
|
||||||
throw new CertificateException("Client authentication not supported");
|
mDelegate.checkClientTrusted(chain, authType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -149,6 +149,6 @@ public class NetworkSecurityTrustManager implements X509TrustManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public X509Certificate[] getAcceptedIssuers() {
|
public X509Certificate[] getAcceptedIssuers() {
|
||||||
return new X509Certificate[0];
|
return mDelegate.getAcceptedIssuers();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ import javax.net.ssl.X509TrustManager;
|
|||||||
* @hide */
|
* @hide */
|
||||||
public class RootTrustManager implements X509TrustManager {
|
public class RootTrustManager implements X509TrustManager {
|
||||||
private final ApplicationConfig mConfig;
|
private final ApplicationConfig mConfig;
|
||||||
private static final X509Certificate[] EMPTY_ISSUERS = new X509Certificate[0];
|
|
||||||
|
|
||||||
public RootTrustManager(ApplicationConfig config) {
|
public RootTrustManager(ApplicationConfig config) {
|
||||||
if (config == null) {
|
if (config == null) {
|
||||||
@@ -47,7 +46,10 @@ public class RootTrustManager implements X509TrustManager {
|
|||||||
@Override
|
@Override
|
||||||
public void checkClientTrusted(X509Certificate[] chain, String authType)
|
public void checkClientTrusted(X509Certificate[] chain, String authType)
|
||||||
throws CertificateException {
|
throws CertificateException {
|
||||||
throw new CertificateException("Client authentication not supported");
|
// Use the default configuration for all client authentication. Domain specific configs are
|
||||||
|
// only for use in checking server trust not client trust.
|
||||||
|
NetworkSecurityConfig config = mConfig.getConfigForHostname("");
|
||||||
|
config.getTrustManager().checkClientTrusted(chain, authType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -84,6 +86,10 @@ public class RootTrustManager implements X509TrustManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public X509Certificate[] getAcceptedIssuers() {
|
public X509Certificate[] getAcceptedIssuers() {
|
||||||
return EMPTY_ISSUERS;
|
// getAcceptedIssuers is meant to be used to determine which trust anchors the server will
|
||||||
|
// accept when verifying clients. Domain specific configs are only for use in checking
|
||||||
|
// server trust not client trust so use the default config.
|
||||||
|
NetworkSecurityConfig config = mConfig.getConfigForHostname("");
|
||||||
|
return config.getTrustManager().getAcceptedIssuers();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user