Google は、黒人コミュニティに対する人種平等の促進に取り組んでいます。取り組みを見る

androidx.security.crypto

Classes

EncryptedFile

Class used to create and read encrypted files.

EncryptedSharedPreferences

An implementation of SharedPreferences that encrypts keys and values.

MasterKey

Wrapper for a master key used in the library.

MasterKeys

Convenient methods to create and obtain master keys in Android Keystore.

Top-level functions summary

EncryptedFile
EncryptedFile(context: Context, file: File, masterKey: MasterKey, fileEncryptionScheme: EncryptedFile.FileEncryptionScheme = FileEncryptionScheme.AES256_GCM_HKDF_4KB, keysetPrefName: String? = null, keysetAlias: String? = null)

Creates an EncryptedFile

SharedPreferences
EncryptedSharedPreferences(context: Context, fileName: String, masterKey: MasterKey, prefKeyEncryptionScheme: EncryptedSharedPreferences.PrefKeyEncryptionScheme = PrefKeyEncryptionScheme.AES256_SIV, prefValueEncryptionScheme: EncryptedSharedPreferences.PrefValueEncryptionScheme = PrefValueEncryptionScheme.AES256_GCM)

Opens an instance of encrypted SharedPreferences

MasterKey
MasterKey(context: Context, keyAlias: String = MasterKey.DEFAULT_MASTER_KEY_ALIAS, keyScheme: MasterKey.KeyScheme = MasterKey.KeyScheme.AES256_GCM, authenticationRequired: Boolean = false, userAuthenticationValidityDurationSeconds: Int = MasterKey.getDefaultAuthenticationValidityDurationSeconds(), requestStrongBoxBacked: Boolean = false)

Creates a MasterKey with the provided parameters.

Top-level functions

EncryptedFile

fun EncryptedFile(
    context: Context,
    file: File,
    masterKey: MasterKey,
    fileEncryptionScheme: EncryptedFile.FileEncryptionScheme = FileEncryptionScheme.AES256_GCM_HKDF_4KB,
    keysetPrefName: String? = null,
    keysetAlias: String? = null
): EncryptedFile

Creates an EncryptedFile

Parameters
context: Context The context to work with.
file: File The backing File.
masterKey: MasterKey The MasterKey that should be used.
fileEncryptionScheme: EncryptedFile.FileEncryptionScheme = FileEncryptionScheme.AES256_GCM_HKDF_4KB The FileEncryptionScheme to use, defaulting to FileEncryptionScheme.AES256_GCM_HKDF_4KB.
keysetPrefName: String? = null The SharedPreferences file to store the keyset for this EncryptedFile.
keysetAlias: String? = null The alias in the SharedPreferences file to store the keyset for this EncryptedFile.

EncryptedSharedPreferences

fun EncryptedSharedPreferences(
    context: Context,
    fileName: String,