-
public class PlatformAccess to platform-specific features.
Server name indication (SNI)Supported on Android 2.3+. Supported on OpenJDK 7+
Session TicketsSupported on Android 2.3+.
Android Traffic Stats (Socket Tagging)Supported on Android 4.0+.
ALPN (Application Layer Protocol Negotiation)Supported on Android 5.0+. The APIs were present in Android 4.4, but that implementation was unstable. Supported on OpenJDK 7 and 8 (via the JettyALPN-boot library). Supported on OpenJDK 9 via SSLParameters and SSLSocket features.
Trust Manager ExtractionSupported on Android 2.3+ and OpenJDK 7+. There are no public APIs to recover the trust manager that was used to create an SSLSocketFactory.
Android Cleartext Permit DetectionSupported on Android 6.0+ via
{@code NetworkSecurityPolicy}.
-
-
Method Summary
Modifier and Type Method Description static Platformget()StringgetPrefix()Prefix used on custom headers. voidconfigureTlsExtensions(SSLSocket sslSocket, String hostname, List<Protocol> protocols)Configure TLS extensions on {@code sslSocket}for{@code route}.voidafterHandshake(SSLSocket sslSocket)Called after the TLS handshake to release resources allocated by . StringgetSelectedProtocol(SSLSocket socket)Returns the negotiated protocol, or null if no protocol was negotiated. voidconnectSocket(Socket socket, InetSocketAddress address, int connectTimeout)voidlog(int level, String message, Throwable t)booleanisCleartextTrafficPermitted(String hostname)ObjectgetStackTraceForCloseable(String closer)Returns an object that holds a stack trace created at the moment this method is executed. voidlogCloseableLeak(String message, Object stackTrace)static List<String>alpnProtocolNames(List<Protocol> protocols)CertificateChainCleanerbuildCertificateChainCleaner(X509TrustManager trustManager)CertificateChainCleanerbuildCertificateChainCleaner(SSLSocketFactory sslSocketFactory)static booleanisConscryptPreferred()SSLContextgetSSLContext()TrustRootIndexbuildTrustRootIndex(X509TrustManager trustManager)voidconfigureSslSocketFactory(SSLSocketFactory socketFactory)-
-
Method Detail
-
configureTlsExtensions
void configureTlsExtensions(SSLSocket sslSocket, String hostname, List<Protocol> protocols)
Configure TLS extensions on
{@code sslSocket}for{@code route}.- Parameters:
hostname- non-null for client-side handshakes; null for server-side handshakes.
-
afterHandshake
void afterHandshake(SSLSocket sslSocket)
-
getSelectedProtocol
@Nullable() String getSelectedProtocol(SSLSocket socket)
Returns the negotiated protocol, or null if no protocol was negotiated.
-
connectSocket
void connectSocket(Socket socket, InetSocketAddress address, int connectTimeout)
-
isCleartextTrafficPermitted
boolean isCleartextTrafficPermitted(String hostname)
-
getStackTraceForCloseable
Object getStackTraceForCloseable(String closer)
Returns an object that holds a stack trace created at the moment this method is executed. Thisshould be used specifically for java.io.Closeable objects and in conjunction with logCloseableLeak.
-
logCloseableLeak
void logCloseableLeak(String message, Object stackTrace)
-
alpnProtocolNames
static List<String> alpnProtocolNames(List<Protocol> protocols)
-
buildCertificateChainCleaner
CertificateChainCleaner buildCertificateChainCleaner(X509TrustManager trustManager)
-
buildCertificateChainCleaner
CertificateChainCleaner buildCertificateChainCleaner(SSLSocketFactory sslSocketFactory)
-
isConscryptPreferred
static boolean isConscryptPreferred()
-
getSSLContext
SSLContext getSSLContext()
-
buildTrustRootIndex
TrustRootIndex buildTrustRootIndex(X509TrustManager trustManager)
-
configureSslSocketFactory
void configureSslSocketFactory(SSLSocketFactory socketFactory)
-
-
-
-