如何使用 Retrofit 添加 TLS v 1.0 和 TLS v.1.1 (How to add TLS v 1.0 and TLS v.1.1 with Retrofit)


問題描述

如何使用 Retrofit 添加 TLS v 1.0 和 TLS v.1.1 (How to add TLS v 1.0 and TLS v.1.1 with Retrofit)

我正在使用改造進行數據傳輸,但幾天前我遇到了 ssl 證書問題:

SSL 握手中止 ssl=0x7b93fcc0 在系統調用期間出現錯誤。對等方重置連接

據我了解,我需要在改造中添加tlsv1證書...

有什麼建議嗎?


參考解法

方法 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

(by Stan MalcolmcleanOK)

參考文件

  1. How to add TLS v 1.0 and TLS v.1.1 with Retrofit (CC BY‑SA 2.5/3.0/4.0)

#tls1.2 #Android #retrofit #SSL






相關問題

如何使用 Retrofit 添加 TLS v 1.0 和 TLS v.1.1 (How to add TLS v 1.0 and TLS v.1.1 with Retrofit)

我的 openssl 和 ssl 默認 CA 證書路徑是什麼? (what is my openssl and ssl Default CA Certs Path?)

LDAP 使用端口 389 失敗 (LDAP fails using port 389)

如何配置 Apache 以接受具有 TLS v1.2 的過期客戶端證書? (How configure Apache to accept expired client certificate with TLS v1.2?)

Docker - 將 localhost HTTPS 服務器從容器發佈到主機 (Docker - Publish localhost HTTPS server from container to host)

SChannel 中的密碼套件選擇 (Cipher suite selection in SChannel)

我可以使用任何客戶端證書連接到在容器中運行的 MQTT 代理 (I'm able to connect to MQTT broker running in a container with any client certificate)

如何為通過 Kestrel 服務器託管 PWA 的 UWP 桌面橋應用配置 https (How to configure https for a UWP Desktop Bridge app hosting a PWA via a Kestrel Server)

如何修復 ERR_SSL_VERSION_OR_CIPHER_MISMATCH 錯誤? (How to fix ERR_SSL_VERSION_OR_CIPHER_MISMATCH error?)

在 Apache 2.4.37 中禁用 TLS 1.0 和 1.1 不起作用 (Disabling TLS 1.0 & 1.1 in Apache 2.4.37 not working)

如何從 Windows 解密其他設備(Wifi 熱點)的 TLS 數據包? (How can I decrypt TLS packets of other devices (Wifi Hotspot) from Windows?)

將備用 IP 地址添加到 kubernetes api 服務器 (add alternative IP address to kubernetes api server)







留言討論