am 303b553b
: Allow an external security provider to be installed
* commit '303b553b13a02529fc8cb22b9b37672887759ce9': Allow an external security provider to be installed
This commit is contained in:
commit
85d0fdbe8f
@ -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});
|
||||
|
Loading…
Reference in New Issue
Block a user