public static aesDecrypt(payload as AESCipherText, key as String, keyEncoding as String = "base64", aad as String = null) as String throws CryptoException:
Decrypts an AES payload produced by aesEncrypt.
| Parameter | Description |
|---|---|
payload | Structured AES payload. |
key | AES key material. |
keyEncoding | Key encoding: base64, base64url, hex or utf8. |
aad | Optional additional authenticated data for GCM. |
Decrypted UTF-8 text.
import klyn.cryptography
key = AESKeyGenerator().generateKey()
payload = Cipher.aesEncrypt("hello", key)
print(Cipher.aesDecrypt(payload, key))