Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
fun generateAesKey(): SecretKey {
val keyGenerator = KeyGenerator.getInstance(KeyProperties.KEY_ALGORITHM_AES, "AndroidKeyStore")
val kgps = KeyGenParameterSpec.Builder("my_aes_key", KeyProperties.PURPOSE_ENCRYPT or KeyProperties.PURPOSE_DECRYPT)
// This is required to be able to provide the IV ourselves
return keyGenerator.generateKey()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment