Created
February 16, 2020 21:35
-
-
Save lordcodes/04dcc7975f1aa29b702d47cc1d58f050 to your computer and use it in GitHub Desktop.
Code for the article: "Protecting secrets in an Android project"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fun encrypt(message: String): ByteArray { | |
| val encryptionKey = generateKey() | |
| val cell = SecureCell(encryptionKey, SecureCell.MODE_SEAL) | |
| val protectedData = cell.protect( | |
| encryptionContext, message.toByteArray() | |
| ) | |
| return protectedData.protectedData | |
| } | |
| private val encryptionContext: ByteArray? = null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment