android-components / mozilla.components.lib.dataprotect / Keystore

Keystore

open class Keystore (source)

Manages data protection using a system-isolated cryptographic key.

This class provides for both:

The specific cryptographic properties are pre-chosen to be the following:

Constructors

<init>

Keystore(label: String, manual: Boolean = false, wrapper: KeyStoreWrapper = KeyStoreWrapper())

Creates a new instance around a key identified by the given label

Properties

label

val label: String

The label the cryptographic key is identified as

Functions

available

fun available(): Boolean

Determines if the managed key is available for use. Consumers can use this to determine if the key was somehow lost and should treat any previously-protected data as invalid.

createDecryptCipher

open fun createDecryptCipher(iv: ByteArray): Cipher

Create a cipher initialized for decrypting data with the managed key.

createEncryptCipher

open fun createEncryptCipher(): Cipher

Create a cipher initialized for encrypting data with the managed key.

decryptBytes

open fun decryptBytes(encrypted: ByteArray): ByteArray

Decrypts data using the managed key.

deleteKey

fun deleteKey(): Unit

Deletes the managed key.

encryptBytes

open fun encryptBytes(plain: ByteArray): ByteArray

Encrypts data using the managed key.

generateKey

fun generateKey(): Boolean

Generates the managed key if it does not already exist.