fix(Desktop): Use BouncyCastle as TLS provider instead of Conscrypt #447 #324

This commit is contained in:
Artem Chepurnyi 2024-07-02 21:52:11 +03:00
parent 7f8cb075da
commit 6140026d29
3 changed files with 8 additions and 4 deletions

View File

@ -21,7 +21,8 @@ kotlin {
implementation(compose.materialIconsExtended)
implementation(compose.desktop.currentOs)
implementation(compose.components.resources)
implementation(libs.conscrypt.openjdk)
implementation(libs.bouncycastle.bcprov)
implementation(libs.bouncycastle.bctls)
implementation(project(":common"))
}
}

View File

@ -70,7 +70,8 @@ import kotlinx.coroutines.flow.mapLatest
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.launch
import kotlinx.datetime.Clock
import org.conscrypt.Conscrypt
import org.bouncycastle.jce.provider.BouncyCastleProvider
import org.bouncycastle.jsse.provider.BouncyCastleJsseProvider
import org.jetbrains.compose.resources.painterResource
import org.jetbrains.compose.resources.stringResource
import org.kodein.di.DI
@ -85,11 +86,12 @@ import java.util.Locale
import kotlin.reflect.KClass
fun main() {
// Add Conscrypt as the first security provider
// Add BouncyCastle as the first security provider
// to make OkHTTP use its TLS instead of a platform
// specific one.
// https://github.com/square/okhttp?tab=readme-ov-file#requirements
Security.insertProviderAt(Conscrypt.newProvider(), 1)
Security.insertProviderAt(BouncyCastleProvider(), 1)
Security.insertProviderAt(BouncyCastleJsseProvider(), 2)
val kamelConfig = KamelConfig {
this.takeFrom(KamelConfig.Default)

View File

@ -231,6 +231,7 @@ landscapist-glide = { module = "com.github.skydoves:landscapist-glide", version.
landscapist-placeholder = { module = "com.github.skydoves:landscapist-placeholder", version.ref = "landscapist" }
bouncycastle-bcpkix = { module = "org.bouncycastle:bcpkix-jdk18on", version.ref = "bouncycastle" }
bouncycastle-bcprov = { module = "org.bouncycastle:bcprov-jdk18on", version.ref = "bouncycastle" }
bouncycastle-bctls = { module = "org.bouncycastle:bctls-jdk18on", version.ref = "bouncycastle" }
mayakapps-window-styler = { module = "com.mayakapps.compose:window-styler", version.ref = "windowStyler" }
microsoft-signalr = { module = "com.microsoft.signalr:signalr", version.ref = "signalr" }
microsoft-signalr-messagepack = { module = "com.microsoft.signalr.messagepack:signalr-messagepack", version.ref = "signalr" }