Created
June 7, 2016 01:33
-
-
Save tzmfreedom/725a3d38e90f47191181fa458e681545 to your computer and use it in GitHub Desktop.
Encryption/Decription for apex
This file contains 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
Blob cryptoKey = Crypto.generateAesKey(128); | |
Blob iv = Blob.valueOf('0123456789012345'); | |
System.debug(EncodingUtil.base64encode(cryptoKey)); | |
Blob data = Blob.valueOf('TestTest'); | |
Blob encryptedData = Crypto.encrypt('AES128', cryptoKey, iv, data); | |
System.debug(EncodingUtil.base64encode(encryptedData)); | |
//Blob decryptedData = Crypto.decrypt('AES128', cryptoKey, encryptedData); | |
//System.debug(decryptedData.toString()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment