Document in Authenticated Encryption #1367
-
Just quote from the gitbook: "Messages encrypted are assumed to be independent. If multiple messages are sent using this API and random nonces, there will be no way to detect if a message has been received twice, or if messages have been reordered. If this is a requirement, see the encrypting a sequence of a set of related messages section." Ideally, random nonces could ensure nonce uniqueness. However, there would be chances that two random nonces are the same. At least in NIST standards, they claim the chances should be lower than 2^{-32}. Due to birthday attack, the number of messages to be encrypted should be limited, especially for GCM and CTR mode with limited nonce size. Reference can be found here: https://soatok.blog/2020/12/24/cryptographic-wear-out-for-symmetric-encryption/ or NIST standards for these different modes. It may be better to point this out in order to avoid bugs. Best way may be rekey after certain limit. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
There's a separate repo for the documentation. That page also mentions the following:
|
Beta Was this translation helpful? Give feedback.
-
That page also includes guidelines for usage limits and how to safely use nonces for each construction. All high-level APIs in libsodium use 192-bit nonces and don't have such limitations. |
Beta Was this translation helpful? Give feedback.
-
There's also a section on nonce extension.
Specifically for AES-GCM, there's now a more efficient way to use large nonces, which is likely to become part of libsodium once the specification is stabilized. |
Beta Was this translation helpful? Give feedback.
That page also includes guidelines for usage limits and how to safely use nonces for each construction.
All high-level APIs in libsodium use 192-bit nonces and don't have such limitations.