Created
December 4, 2017 16:08
-
-
Save yakivmospan/a26f5f4af4c5282ee5ec4f67e9da476e to your computer and use it in GitHub Desktop.
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
// Create and Save asymmetric key | |
keyStoreWrapper.createAndroidKeyStoreSymmetricKey("MASTER_KEY") | |
// Get key from keyStore | |
val masterKey = keyStoreWrapper.getAndroidKeyStoreSymmetricKey("MASTER_KEY") | |
// Creates Cipher with symmetric transformation and provides encrypt and decrypt functions | |
val cipher = CipherWrapper("AES/CBC/PKCS7Padding") | |
// Encrypt message | |
val encryptedMessage = cipher.encrypt(message, masterKey) | |
// Decrypt message | |
val decryptedMessage = cipher.decrypt(encryptedMessage, masterKey) | |
// Ooops, InvalidKeyException: no IV set when one expected |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment