public class Cipher:
import klyn.cryptography
keyGenerator = AESKeyGenerator()
keyGenerator.initialize(256)
key = keyGenerator.generateKey()
payload = Cipher.aesGcmEncrypt("secret", key)
plain = Cipher.aesGcmDecrypt(payload, key)
print(plain)| Modifier and Type | Member | Description |
|---|---|---|
| public static | aesCbcDecryptaesCbcDecrypt(payload as AESCipherText, key as String, keyEncoding as String = "base64") as String throws CryptoException: |
Convenience AES-CBC decryption helper. |
| public static | aesCbcEncryptaesCbcEncrypt(plainText as String, key as String, keyEncoding as String = "base64", iv as String = null, ivEncoding as String = "base64") as AESCipherText throws CryptoException: |
Convenience AES-CBC encryption helper. |
| public static | aesCtrDecryptaesCtrDecrypt(payload as AESCipherText, key as String, keyEncoding as String = "base64") as String throws CryptoException: |
Convenience AES-CTR decryption helper. |
| public static | aesCtrEncryptaesCtrEncrypt(plainText as String, key as String, keyEncoding as String = "base64", iv as String = null, ivEncoding as String = "base64") as AESCipherText throws CryptoException: |
Convenience AES-CTR encryption helper. |
| public static | aesDecryptaesDecrypt(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`. |
| public static | aesEncryptaesEncrypt(plainText as String, key as String, mode as String = "GCM", keyEncoding as String = "base64", iv as String = null, ivEncoding as String = "base64", aad as String = null) as AESCipherText throws CryptoException: |
Encrypts text with AES. |
| public static | aesGcmDecryptaesGcmDecrypt(payload as AESCipherText, key as String, keyEncoding as String = "base64", aad as String = null) as String throws CryptoException: |
Convenience AES-GCM decryption helper. |
| public static | aesGcmEncryptaesGcmEncrypt(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. |
| public static | rsaDecrypt | Decrypts RSA ciphertext with a private key. |
| public static | rsaEncrypt | Encrypts text with an RSA public key. |