doc: improve CCM example

The nonce must be transmitted along with ciphertext and tag.

PR-URL: https://github.com/nodejs/node/pull/19851
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
Tobias Nießen 2018-04-06 14:32:35 +02:00
parent dff214153f
commit 99c77dc018
No known key found for this signature in database
GPG Key ID: 718207F8FD156B70

View File

@ -2267,7 +2267,7 @@ const ciphertext = cipher.update(plaintext, 'utf8');
cipher.final();
const tag = cipher.getAuthTag();
// Now transmit { ciphertext, tag }.
// Now transmit { ciphertext, nonce, tag }.
const decipher = crypto.createDecipheriv('aes-192-ccm', key, nonce, {
authTagLength: 16