The detached interface uses 2 separate buffers for the ciphertext and the message authentication tag. This allows users to encrypt and decrypt data in-place, in buffer buf.
By default, these functions use the whole buf, but users can choose to only pass a portion of buf, by passing one or both of these optional arguments:
offset: start at position offset in buf (0 by default)
len: take only the first len bytes in buf, starting at offset (Note: As opposed to not passing len at all, passing len=0 will result in using an empty buffer.)
box buf tag n pk sk authenticates and encrypts in-place the plaintext in buf using public key pk, secret key sk, and nonce n and writes the message authentication tag in tag. Returns true if successful.
box_open buf tag n pk sk attempts to verify and decrypt in-place the ciphertext in ct and message authentication tag tag using public key pk, secret key sk, and nonce n. Returns true if successful.
box buf tag n pk sk authenticates and encrypts in-place the plaintext in buf using shared key ck and nonce n and writes the message authentication tag in tag. Returns true if successful.
box_open buf tag n pk sk attempts to verify and decrypt in-place the ciphertext in ct and message authentication tag tag using shared key ck and nonce n. Returns true if successful.
secretbox buf tag n key authenticates and encrypts in-place the plaintext in buf using secret key key and nonce n and writes the message authentication tag in tag. Returns true if successful.
secretbox_open buf tag n key attempts to verify and decrypt in-place the ciphertext in buf and message authentication tag tag using secret key key and nonce n. Returns true if successful.