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:
Keystore(label: String)
Creates a new instance around a key identified by the given label |
val label: String
The label the cryptographic key is identified as |
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. |
|
fun createDecryptCipher(iv: ByteArray): Cipher
Create a cipher initialized for decrypting data with the managed key. |
|
fun createEncryptCipher(): Cipher
Create a cipher initialized for encrypting data with the managed key. |
|
fun decryptBytes(encrypted: ByteArray): ByteArray
Decrypts data using the managed key. |
|
fun deleteKey(): Unit
Deletes the managed key. |
|
fun encryptBytes(plain: ByteArray): ByteArray
Encrypts data using the managed key. |
|
fun generateKey(): Boolean
Generates the managed key if it does not already exist. |