Fill the blank
Create an AES key that never leaves the Keystore.
fun createKey(): javax.crypto.SecretKey {
val generator = javax.crypto.KeyGenerator.getInstance(
android.security.keystore.KeyProperties.KEY_ALGORITHM_AES, "____")
generator.init(
android.security.keystore.KeyGenParameterSpec.Builder("token_key",
android.security.keystore.KeyProperties.PURPOSE_ENCRYPT or
android.security.keystore.KeyProperties.PURPOSE_DECRYPT)
.setBlockModes(android.security.keystore.KeyProperties.BLOCK_MODE_GCM)
.setEncryptionPaddings(android.security.keystore.KeyProperties.ENCRYPTION_PADDING_NONE)
.build())
return generator.generateKey()
}Hint 1 of 1
The provider name is one word with capitals.
Choose an answer, then open Show answer below to check it.
Show answer
Answer: A AndroidKeyStore
Correct. That provider name puts the key in the Keystore.
Why not the others?
- B BC. Bouncy Castle keys live in app memory.
- C AES. That's the algorithm, not the provider.
- D Keychain. That's iOS.