Std.Crypto.seal
1 declaration
fn
seal: &Bytes -> &Bytes -> &Bytes -> &Bytes -> Option[Bytes]This is a callable function.
What it does
Encrypt a message so that changing it is detected.
Encryption alone hides a message and says nothing about whether it arrived
as it was sent. Someone who cannot read a message can still change it, and
a program that decrypts whatever it is handed will act on the result. This
answers a sealed message whose tag covers both the encrypted part and the
associated part beside it — a record identifier, a version, a purpose —
which is how context that must travel in the clear is still protected from
being swapped.
The nonce must never be used twice with one key. Reusing one does not
merely weaken this, it reveals the messages, so derive a nonce or count
one; never reuse a fixed value.
Answers nothing when the key or nonce is the wrong length, which is a
mistake in the program rather than a fact about the message.
Read the signature
- The text after the name is the type checked by Pudu.
- Read arrows from left to right: inputs come first, and the final type is returned.
- & borrows a value for this call instead of moving or copying it.
- Names inside [ ] are type arguments, such as the item type held by a collection.
- Option holds Some(value) or None when no value is available.
