Allow an external security provider to be installed
b/18001842 Change-Id: I8312fe541896e1ceeb6c5102f90bdbb0bb945151
This commit is contained in:
parent
a908d45ae3
commit
303b553b13
@ -138,16 +138,15 @@ public class SSLUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static abstract class ExternalSecureSocketFactoryBuilder {
|
public static abstract class ExternalSecurityProviderInstaller {
|
||||||
abstract public javax.net.ssl.SSLSocketFactory createSecureSocketFactory(
|
abstract public void installIfNeeded(final Context context);
|
||||||
final Context context, final int handshakeTimeoutMillis);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ExternalSecureSocketFactoryBuilder sExternalSocketFactoryBuilder;
|
private static ExternalSecurityProviderInstaller sExternalSecurityProviderInstaller;
|
||||||
|
|
||||||
public static void setExternalSecureSocketFactoryBuilder(
|
public static void setExternalSecurityProviderInstaller (
|
||||||
ExternalSecureSocketFactoryBuilder builder) {
|
ExternalSecurityProviderInstaller installer) {
|
||||||
sExternalSocketFactoryBuilder = builder;
|
sExternalSecurityProviderInstaller = installer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -159,6 +158,11 @@ public class SSLUtils {
|
|||||||
public synchronized static javax.net.ssl.SSLSocketFactory getSSLSocketFactory(
|
public synchronized static javax.net.ssl.SSLSocketFactory getSSLSocketFactory(
|
||||||
final Context context, final HostAuth hostAuth, final KeyManager keyManager,
|
final Context context, final HostAuth hostAuth, final KeyManager keyManager,
|
||||||
final boolean insecure) {
|
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 {
|
try {
|
||||||
final KeyManager[] keyManagers = (keyManager == null ? null :
|
final KeyManager[] keyManagers = (keyManager == null ? null :
|
||||||
new KeyManager[]{keyManager});
|
new KeyManager[]{keyManager});
|
||||||
|
Loading…
Reference in New Issue
Block a user