lock-openAES-GCM Decrypt

Decrypt data that was encrypted with AES-256-GCMarrow-up-right. Verifies the authentication tag before returning the plaintext. If the tag does not match (indicating tampering or wrong key), the call fails.

Input

Raw bytes in the following layout:

Offset
Field
Type
Description

[0:32]

key

32 bytes

AES-256 key (must match encryption key)

[32:44]

nonce

12 bytes

Initialization vector

[44:]

ciphertext + auth tag

bytes

Encrypted data with authentication tag

Output

Bytes
Type
Description

plaintext

bytes

Decrypted data

Use cases

  • On-chain decryption of previously encrypted data

  • Decrypting messages from other contracts or users

  • Verifying and reading encrypted event data within a contract

Examples

Built-in helper

Manual usage

Last updated