crypto_sealAPIs are designed to encrypt independent messages.
crypto_secretstreamAPI that satisfies the above constraints. This API is recommended to encrypt files or for secure communications over a reliable protocol with ordering guarantees, such as TCP.
kBAare known by both parties, messages sent by
Bare encrypted using the secret key
kAB, whereas messages sent by
Awill be encrypted using
crypto_kx()functions) creates two different keys for that purpose.
AESdo not feature nonces large enough to be randomly chosen without taking the risk of repeating a nonce.
Nis used by the protocol. Its initial value can be randomly chosen.
AESis a requirement, using a cipher with a longer nonce is easier and safer.