Set TLS1.3 as enabled protocol in WebDAV-client on Android >= v10
Fixes #374
This commit is contained in:
parent
b398a008b0
commit
ad8a2ae747
@ -11,7 +11,12 @@ internal object SSLSocketFactories {
|
|||||||
|
|
||||||
fun from(trustManager: X509TrustManager): SSLSocketFactory {
|
fun from(trustManager: X509TrustManager): SSLSocketFactory {
|
||||||
return try {
|
return try {
|
||||||
val sslContext = SSLContext.getInstance("TLSv1.2")
|
val tlsVersion = if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.Q) {
|
||||||
|
"TLSv1.3"
|
||||||
|
} else {
|
||||||
|
"TLSv1.2"
|
||||||
|
}
|
||||||
|
val sslContext = SSLContext.getInstance(tlsVersion)
|
||||||
sslContext.init(null, arrayOf<TrustManager>(trustManager), null)
|
sslContext.init(null, arrayOf<TrustManager>(trustManager), null)
|
||||||
sslContext.socketFactory
|
sslContext.socketFactory
|
||||||
} catch (e: GeneralSecurityException) {
|
} catch (e: GeneralSecurityException) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user