My api only supports following CipherSuits
(found this with help of ssllab)
TLSv1.2
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 - OkHttp: yes
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 - OkHttp: yes
TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 - OkHttp: yes
TLS_DHE_RAS_WITH_AES_128_GCM_SHA256 - OkHttp: no
all of these are supported on Android api 20+ as seen on SSLSocket
I tried adding support for TLSv1.2 to OkHttp but, I Still get usual error
HTTP FAILED: javax.net.ssl.SSLHandshakeException: com.android.org.bouncycastle.jce.exception.ExtCertPathValidatorException: Could not validate certificate: null
then I added those CipherSuits
to ConnectionSpec
and failed
ConnectionSpec cs = new ConnectionSpec.Builder(ConnectionSpec.MODERN_TLS)
.tlsVersions(TlsVersion.TLS_1_2)
.cipherSuites(
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
)
.build();
HTTP FAILED: java.net.UnknownServiceException: Unable to find acceptable protocols. isFallback=false, modes=[ConnectionSpec(cipherSuites=[TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_256_GCM_SHA384], tlsVersions=[TLS_1_2], supportsTlsExtensions=true)], supported protocols=[TLSv1.2]
Connection works fine on Android api 21 and above.
So is it possible to add support for these CipherSuits
?