Secret Storing Utils
Offers simple methods to securely store secrets in an Android Application. The encryption keys are randomly generated and securely managed by the key store, thus your secrets are safe. You only need to remember a key alias to perform encrypt/decrypt operations.
Android M++ On android M+, the keystore can generates and store AES keys via API. But below API M this functionality is not available.
Android [K-M[ For android >=L and
Sample usage: val secret = "The answer is 42" val KEncrypted = SecretStoringUtils.securelyStoreString(secret, "myAlias") //This can be stored anywhere e.g. encoded in b64 and stored in preference for example
//to get back the secret, just call
val kDecrypted = SecretStoringUtils.loadSecureSecret(KEncrypted, "myAlias")
You can also just use this utility to store a secret key, and use any encryption algorithm that you want.
Important: Keys stored in the keystore can be wiped out (depends of the OS version, like for example if you add a pin or change the schema); So you might and with a useless pile of bytes.
Constructors
Types
Functions
Allows creation of the crypto keys associated witht he alias before encrypting some value with it.
Decrypt a secret that was encrypted by securelyStoreBytes.
Deletes the key associated with the keyAlias and logs any KeyStoreException that could happen.
Encrypt the given secret using the android Keystore. On android >= M, will directly use the keystore to generate a symmetric key On android >= Lollipop and