am 6b1f5824: am 94190da3: am dc6f3aaf: am 85d0fdbe: am 303b553b: Allow an external security provider to be installed

* commit '6b1f582457c907acb154f5f326aa6c7a602105c4':
  Allow an external security provider to be installed
This commit is contained in:
Martin Hibdon 2014-11-02 19:03:25 +00:00 committed by Android Git Automerger
commit 6b9592b084
1 changed files with 11 additions and 7 deletions

View File

@ -138,16 +138,15 @@ public class SSLUtils {
}
}
public static abstract class ExternalSecureSocketFactoryBuilder {
abstract public javax.net.ssl.SSLSocketFactory createSecureSocketFactory(
final Context context, final int handshakeTimeoutMillis);
public static abstract class ExternalSecurityProviderInstaller {
abstract public void installIfNeeded(final Context context);
}
private static ExternalSecureSocketFactoryBuilder sExternalSocketFactoryBuilder;
private static ExternalSecurityProviderInstaller sExternalSecurityProviderInstaller;
public static void setExternalSecureSocketFactoryBuilder(
ExternalSecureSocketFactoryBuilder builder) {
sExternalSocketFactoryBuilder = builder;
public static void setExternalSecurityProviderInstaller (
ExternalSecurityProviderInstaller installer) {
sExternalSecurityProviderInstaller = installer;
}
/**
@ -159,6 +158,11 @@ public class SSLUtils {
public synchronized static javax.net.ssl.SSLSocketFactory getSSLSocketFactory(
final Context context, final HostAuth hostAuth, final KeyManager keyManager,
final boolean insecure) {
// If we have an external security provider installer, then install. This will
// potentially replace the default implementation of SSLSocketFactory.
if (sExternalSecurityProviderInstaller != null) {
sExternalSecurityProviderInstaller.installIfNeeded(context);
}
try {
final KeyManager[] keyManagers = (keyManager == null ? null :
new KeyManager[]{keyManager});