klyn.cryptography.Cipher.aesDecrypt
method

    public static aesDecrypt(payload as AESCipherText, key as String, keyEncoding as String = "base64", aad as String = null) as String throws CryptoException:

Description

Decrypts an AES payload produced by `aesEncrypt`.

Parameters

- payload Structured AES payload.
- key AES key material.
- keyEncoding Key encoding: `base64`, `base64url`, `hex` or `utf8`.
- aad Optional additional authenticated data for `GCM`.

Returns

Decrypted UTF-8 text.

Throws

- CryptoException when authentication or decryption fails. ```klyn import klyn.cryptography key = AESKeyGenerator().generateKey() payload = Cipher.aesEncrypt("hello", key) print(Cipher.aesDecrypt(payload, key)) ```