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:
Convenience AES-GCM encryption helper.
| Parameter | Description |
|---|---|
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. |
Structured AES-GCM payload.
import klyn.cryptography
key = AESKeyGenerator().generateKey()
payload = Cipher.aesGcmEncrypt("hello", key)
print(payload.tagBase64)