crypt.decrypt
Decrypts Base64 AES-256-CBC ciphertext.
Returns the original raw plaintext. Uses the same key/IV folding as crypt.encrypt.
crypt.decrypt(ciphertext: string, key: string, iv: string): stringParameters
| Parameter | Type | Description |
|---|---|---|
ciphertext | string | Base64 ciphertext from crypt.encrypt. |
key | string | Base64 key material. |
iv | string | Base64 IV returned by crypt.encrypt. |
Example
local key = crypt.generatekey()
local ciphertext, iv = crypt.encrypt("example", key)
local plaintext = crypt.decrypt(ciphertext, key, iv)
print(plaintext)Example output
exampleErrors: Invalid Base64, non-block-aligned ciphertext and invalid padding can raise decryption errors.
