Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8e19803a authored by Chad Brubaker's avatar Chad Brubaker Committed by Gerrit Code Review
Browse files

Merge "Implement checkClientTrusted"

parents e766e399 bdd13f02
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -65,7 +65,7 @@ public class NetworkSecurityTrustManager implements X509TrustManager {
    @Override
    public void checkClientTrusted(X509Certificate[] chain, String authType)
            throws CertificateException {
        throw new CertificateException("Client authentication not supported");
        mDelegate.checkClientTrusted(chain, authType);
    }

    @Override
@@ -149,6 +149,6 @@ public class NetworkSecurityTrustManager implements X509TrustManager {

    @Override
    public X509Certificate[] getAcceptedIssuers() {
        return new X509Certificate[0];
        return mDelegate.getAcceptedIssuers();
    }
}
+9 −3
Original line number Diff line number Diff line
@@ -35,7 +35,6 @@ import javax.net.ssl.X509TrustManager;
 * @hide */
public class RootTrustManager implements X509TrustManager {
    private final ApplicationConfig mConfig;
    private static final X509Certificate[] EMPTY_ISSUERS = new X509Certificate[0];

    public RootTrustManager(ApplicationConfig config) {
        if (config == null) {
@@ -47,7 +46,10 @@ public class RootTrustManager implements X509TrustManager {
    @Override
    public void checkClientTrusted(X509Certificate[] chain, String authType)
            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
@@ -84,6 +86,10 @@ public class RootTrustManager implements X509TrustManager {

    @Override
    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();
    }
}