mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
Fix deprecated API usage.
This commit is contained in:
+6
-4
@@ -18,7 +18,7 @@ package io.element.android.libraries.androidutils.file
|
|||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.security.crypto.EncryptedFile
|
import androidx.security.crypto.EncryptedFile
|
||||||
import androidx.security.crypto.MasterKeys
|
import androidx.security.crypto.MasterKey
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
class EncryptedFileFactory(
|
class EncryptedFileFactory(
|
||||||
@@ -26,11 +26,13 @@ class EncryptedFileFactory(
|
|||||||
) {
|
) {
|
||||||
fun create(file: File): EncryptedFile {
|
fun create(file: File): EncryptedFile {
|
||||||
// We need to use the same key for all the encrypted files.
|
// We need to use the same key for all the encrypted files.
|
||||||
val masterKeyAlias = MasterKeys.getOrCreate(MasterKeys.AES256_GCM_SPEC)
|
val masterKey = MasterKey.Builder(context)
|
||||||
|
.setKeyScheme(MasterKey.KeyScheme.AES256_GCM)
|
||||||
|
.build()
|
||||||
return EncryptedFile.Builder(
|
return EncryptedFile.Builder(
|
||||||
file,
|
|
||||||
context,
|
context,
|
||||||
masterKeyAlias,
|
file,
|
||||||
|
masterKey,
|
||||||
EncryptedFile.FileEncryptionScheme.AES256_GCM_HKDF_4KB
|
EncryptedFile.FileEncryptionScheme.AES256_GCM_HKDF_4KB
|
||||||
).build()
|
).build()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user