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

余生颓废 提交于 2019-12-13 02:55:44

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/33693120/how-to-add-tls-v-1-0-and-tls-v-1-1-with-retrofit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!