klyn.cryptography.Cipher.aesGcmEncrypt
method

    public static aesGcmEncrypt(plainText as String, key as String, keyEncoding as String = "base64", iv as String = null, ivEncoding as String = "base64", aad as String = null) as AESCipherText throws CryptoException:

Description

Convenience AES-GCM encryption helper.

Parameters

- plainText Source text interpreted as UTF-8.
- key AES key material.
- keyEncoding Key encoding. Defaults to `base64`.
- iv Optional nonce.
- ivEncoding IV encoding when `iv` is provided.
- aad Optional additional authenticated data.

Returns

Structured AES-GCM payload.

Throws

- CryptoException when encryption fails. ```klyn import klyn.cryptography key = AESKeyGenerator().generateKey() payload = Cipher.aesGcmEncrypt("hello", key) print(payload.tagBase64) ```