Skip to content

Instantly share code, notes, and snippets.

@tianhaoz95
Created February 27, 2020 04:40
Show Gist options
  • Save tianhaoz95/aaac07ac6d2c4f648ee79c016dee56ea to your computer and use it in GitHub Desktop.
Save tianhaoz95/aaac07ac6d2c4f648ee79c016dee56ea to your computer and use it in GitHub Desktop.
Decrypt message from the encrypted message string
crypto.Key key = crypto.Key.fromUtf8(padCryptionKey(token));
crypto.IV iv = crypto.IV.fromLength(16);
crypto.Encrypter encrypter = crypto.Encrypter(crypto.AES(key));
crypto.Encrypted encryptedMsg = crypto.Encrypted.fromBase64(msg);
msg = encrypter.decrypt(encryptedMsg, iv: iv);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment