Skip to main content
Decrypts an AES-encrypted string using the matching key, IV, and mode.
key and iv must match the values used during encryption - implying same 32-byte base64 key, same 16-byte base64 IV. mode defaults to "CBC" if omitted.
Accepts the same set as crypt.encrypt(): "CBC", "ECB", "CTR", "CFB", "OFB", "GCM".
Learn more here.
Most commonly used to recover payloads sent via crypt.encrypt().

Parameters

Returns

string - the recovered plaintext.

Example

Read a token cached to disk by crypt.encrypt and recover the plaintext.
Ensure the key and IV lengths match the expectations of the selected cipher mode.