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 committed 2018-04-09 16:32:12 +02:00
1 parent dff214153f
commit 99c77dc018
1 file changed
+1 -1
+1 -1
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