I am testing on Android 4.2.2 (API 17) and running following code.
KeyManagerFactory kmf = .... //generating KeyManagerFactory
if (kmf == null) {
throw new UnexpectedInternalException("Initialisation of SSLContext failed!");
}
KeyManager[] keyManagers = kmf.getKeyManagers();
SSLContext sslContext = SSLContext.getInstance("TLSv1.2");
sslContext.init(keyManagers, null, null);
SSLSocketFactory f = sslContext.getSocketFactory();
and when I inspect the SocketFactory, I see below:
I run the same code on Android 6.0 and it does return TLSv1.2
. According to SSLContext API docs, TLSv1.2
is supported from API 16+ and Android 4.2.2 is API 17. It should return TLSv1.2
but not sure why it is not returning in the enabledProtocols
.