From 91d28658fcce4d22f880376170279e80181e981f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Mon, 19 Apr 2021 18:03:52 +0200 Subject: [PATCH] crypto: Correctly decode the byte array when importing keys --- .../java/org/matrix/android/sdk/internal/crypto/OlmMachine.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/OlmMachine.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/OlmMachine.kt index 3e46dac83f..9e9f3bdf94 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/OlmMachine.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/OlmMachine.kt @@ -19,6 +19,7 @@ package org.matrix.android.sdk.internal.crypto import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import java.io.File +import java.nio.charset.Charset import java.util.concurrent.ConcurrentHashMap import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext @@ -388,7 +389,7 @@ internal class OlmMachine(user_id: String, device_id: String, path: File, device */ @Throws(CryptoStoreErrorException::class) suspend fun importKeys(keys: ByteArray, passphrase: String, listener: ProgressListener?): ImportRoomKeysResult = withContext(Dispatchers.IO) { - var decodedKeys = keys.toString() + val decodedKeys = String(keys, Charset.defaultCharset()) var rustListener = CryptoProgressListener(listener)