Stan Malcolm
Stan Malcolm

Reputation: 2810

How to add TLS v 1.0 and TLS v.1.1 with Retrofit

I am using retrofit for data transfer, but few days ago i got problem with ssl certificates:

SSL handshake aborted ssl=0x7b93fcc0 error during system call. Connection reset by peer

as I understand I need to add tlsv1 certificate inside retrofit...

any suggestions how to do it?

Upvotes: 1

Views: 4011

Answers (1)

cleanOK
cleanOK

Reputation: 304

If you are using OkHttp client for Retrofit, you should set up cipher suites like here, just change the TLS version and suits accordingly to your connection type:

ConnectionSpec spec = new ConnectionSpec.Builder(ConnectionSpec.MODERN_TLS)  
.tlsVersions(TlsVersion.TLS_1_2)
.cipherSuites(
      CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
      CipherSuite.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
      CipherSuite.TLS_DHE_RSA_WITH_AES_128_GCM_SHA256)
.build();

more details on Square's OkHttp wiki

Upvotes: 2

Related Questions