crypto.decrypt()
Authenticates and decrypts AES-256-GCM data.
Signature
crypto.decrypt(key, sealed[, associated_data])
Parameters
32-byte key, dictionary with nonce, data and tag, and optional matching associated data (default empty).
Returns
Packed plaintext.
Behavior
Verifies the tag before giving plaintext to the caller.
Errors
Authentication failure, bad key/nonce/tag length or missing/invalid byte fields.
Example
use crypto
use binary
k = crypto.random(32)
sealed = crypto.encrypt(k, 'Atom', 'record-v1')
assert(binary.text(crypto.decrypt(k, sealed, 'record-v1')) == 'Atom')