plaintext = crypto.aead.decrypt(key, nonce, boxed)
plaintext = crypto.aead.decrypt(key, nonce, boxed, associatedData)
| Parameter | Description |
|---|---|
| key | a uint8 vector of 32 bytes or 64 hexadecimal characters: secret key. |
| nonce | a uint8 vector of 24 bytes or 48 hexadecimal characters: unique per message for a given key (use crypto.random). |
| boxed | a uint8 vector or hexadecimal text: the 16-byte authentication tag followed by the ciphertext, as produced by crypto.aead.encrypt. |
| associatedData | a uint8 vector (raw bytes) or a character vector (UTF-8 bytes): the same associated data passed to encrypt. |
| Parameter | Description |
|---|---|
| plaintext | a uint8 row vector: the decrypted bytes. |
crypto.aead.decrypt verifies the authentication tag and returns the plaintext of a message produced by crypto.aead.encrypt.
It raises Nelson:core:aeadAuthenticationFailed when the key, nonce, associated data or encrypted message has been altered; never use unauthenticated data.
key = crypto.random(32);
nonce = crypto.random(24);
boxed = crypto.aead.encrypt(key, nonce, uint8([1 2 3 4]));
crypto.aead.decrypt(key, nonce, boxed)
| Version | Description |
|---|---|
| 2.0.0 | initial version |