Commit 0504c4f6 authored by Ricki Hirner's avatar Ricki Hirner 🐑

Use Conscrypt

parent 088da022
Pipeline #57512418 passed with stage
in 13 minutes and 12 seconds
package at.bitfire.icsdroid
import android.content.Context
import at.bitfire.cert4android.CertTlsSocketFactory
import at.bitfire.cert4android.CustomCertManager
import okhttp3.Interceptor
import okhttp3.OkHttpClient
import okhttp3.Response
import okhttp3.internal.tls.OkHostnameVerifier
import java.util.concurrent.TimeUnit
class HttpClient private constructor(
context: Context
......@@ -34,12 +34,17 @@ class HttpClient private constructor(
// so we don't need to close it
private val certManager = CustomCertManager(context)
private val sslContext = SSLContext.getInstance("TLS")
init {
sslContext.init(null, arrayOf(certManager), null)
val okHttpClient: OkHttpClient = OkHttpClient.Builder()
.connectTimeout(10, TimeUnit.SECONDS)
.readTimeout(60, TimeUnit.SECONDS)
.sslSocketFactory(CertTlsSocketFactory(null, certManager))
.sslSocketFactory(sslContext.socketFactory, certManager)
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment