| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent e2484b2 commit d4e8714
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -493,7 +493,7 @@ _additional authenticated data_ (AAD) input parameter. | |||
| 493 | 493 | ||
| 494 | 494 | The `options` argument is optional for `GCM`. When using `CCM`, the | |
| 495 | 495 | `plaintextLength` option must be specified and its value must match the length | |
| 496 | - of the plaintext in bytes. See [CCM mode][]. | ||
| 496 | + of the ciphertext in bytes. See [CCM mode][]. | ||
| 497 | 497 | ||
| 498 | 498 | The `decipher.setAAD()` method must be called before [`decipher.update()`][]. | |
| 499 | 499 | ||
@@ -3104,7 +3104,12 @@ mode must adhere to certain restrictions when using the cipher API: | |||
| 3104 | 3104 | mode might fail as CCM cannot handle more than one chunk of data per instance. | |
| 3105 | 3105 | * When passing additional authenticated data (AAD), the length of the actual | |
| 3106 | 3106 | message in bytes must be passed to `setAAD()` via the `plaintextLength` | |
| 3107 | - option. This is not necessary if no AAD is used. | ||
| 3107 | + option. | ||
| 3108 | + Many crypto libraries include the authentication tag in the ciphertext, | ||
| 3109 | + which means that they produce ciphertexts of the length | ||
| 3110 | + `plaintextLength + authTagLength`. Node.js does not include the authentication | ||
| 3111 | + tag, so the ciphertext length is always `plaintextLength`. | ||
| 3112 | + This is not necessary if no AAD is used. | ||
| 3108 | 3113 | * As CCM processes the whole message at once, `update()` can only be called | |
| 3109 | 3114 | once. | |
| 3110 | 3115 | * Even though calling `update()` is sufficient to encrypt/decrypt the message, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments