Commit cde55162 authored by Him188's avatar Him188

Fix ecdh availability detect

parent b3c97c16
......@@ -42,14 +42,13 @@ actual fun ECDH() = ECDH(ECDH.generateKeyPair())
actual class ECDH actual constructor(actual val keyPair: ECDHKeyPair) {
actual companion object {
private var isECDHAvailable = false
private var isECDHAvailable = true
init {
if (kotlin.runCatching {
Security.addProvider(BouncyCastleProvider())
generateKeyPair() // try if it is working
}.isSuccess) {
isECDHAvailable = true
}
isECDHAvailable = kotlin.runCatching {
Security.addProvider(BouncyCastleProvider())
generateKeyPair() // try if it is working
}.isSuccess
}
actual fun generateKeyPair(): ECDHKeyPair {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment