Update crypto.md to correct description of `decipher.setAuthTag` by jbuhacoff · Pull Request #33097 · nodejs/node

@jbuhacoff

Calling `decipher.setAuthTag` after `decipher.update` will result in an error like `Unsupported state or unable to authenticate data`. The example code in [CCM mode](https://nodejs.org/docs/latest-v14.x/api/crypto.html#crypto_ccm_mode) is correct, but to demonstrate the mistake in the documentation you can take the same example and move the `setAuthTag` call to in between `update` and `final` you will see the error.

@nodejs-github-bot added crypto

Issues and PRs related to the crypto subsystem.

doc

Issues and PRs related to the documentations.

labels

Apr 27, 2020

@jbuhacoff

Restore note about calling setAuthTag before decipher.final and add new note about calling it before decipher.update for CCM mode.

mscdex

Added detail to note about calling setAuthTag before decipher.final to mention that for CCM mode it must be called before decipher.update.
Added detail to descripption of `decipher.setAuthTag()` method that it must be called before `decipher.update()` for `CCM` mode.

bnoordhuis

tniessen