klyn.cryptography.Cipher.aesGcmDecrypt
method

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

Description

Convenience AES-GCM decryption helper.

Parameters

Parameter | Description
--- | ---
`payload` | Structured AES-GCM payload.
`key` | AES key material.
`keyEncoding` | Key encoding. Defaults to `base64`.
`aad` | Optional additional authenticated data.

Returns

Decrypted UTF-8 text.

Throws

- CryptoException on authentication or decryption failure.

Example

    import klyn.cryptography

    key = AESKeyGenerator().generateKey()
    payload = Cipher.aesGcmEncrypt("hello", key)
    print(Cipher.aesGcmDecrypt(payload, key))