skip to Main Content

Android Studio – AES Encryption in Kotlin

The Android docs give the following snippet for how to encrypt a message in AES: val plaintext: ByteArray = ... val keygen = KeyGenerator.getInstance("AES") keygen.init(256) val key: SecretKey = keygen.generateKey() val cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING") cipher.init(Cipher.ENCRYPT_MODE, key) val ciphertext: ByteArray =…

VIEW QUESTION
Back To Top
Search