14

The library uses XChaCha20Poly1305 and that requires a nonce of 192-bit (24-byte). It is an extension of ChaCha20Poly1305 to increase the nonce size, ChaCha20 had 96-bit nonces. There is no standard for it, only a draft in ietf.org The nonce is an acronym for 'number used once'. The crucial point is that one must never use the (Key, nonce) pair again. We ...


14

There are two main ways to have the same symmetric key on both parties: key exchange using asymmetric crypto generate the key from a known secret (eg: a password), such as using a password-based key-derivation function The former is what you will find in TLS, where public key infrastructure is used to verify the other party's public key. The latter is used ...


3

Yes, and Key-Encryption Keys often are symmetric. When they are, they do not bring the benefits of asymmetric cryptography; in particular, anyone with the KEK and passively eavesdropped ciphertext can decrypt the distributed keys. That does not make use of symmetric KEK pointless: KEK would typically be distributed, stored and used with more precautions (...


3

You should generate a random* nonce and store it alongside the ciphertext, e.g. prepended to it. Both ChaCha20 and Poly1305 require a unique nonce to be used for each encryption, otherwise they will not be secure. However, the nonce does not need to be kept secret, so you can just include it with the ciphertext. *) Technically, the nonce for ChaCha20–...


Only top voted, non community-wiki answers of a minimum length are eligible