pub enum CipherText<Leaf, P> {
Single(Leaf),
Sequence(Vec<CipherText<Leaf, P>>),
EmptySequence(Leaf),
Map(Vec<(String, CipherText<Leaf, P>)>),
EmptyMap(Leaf),
Passthrough(P),
}Expand description
The ciphertext tree encrypt produces and
decrypt consumes.
The shape mirrors the structure of the plaintext that was encrypted: a
scalar yields Single, while non-empty sequences
and maps yield Sequence and
Map. Empty composites use the authenticated marker
variants EmptySequence and
EmptyMap, since they contain no element
ciphertexts to authenticate the supplied AAD. Nested structures are
represented recursively. An absent value (Option::None, a host null)
is a null leaf, a Single like any other scalar: the plain null, or a
typed null padded to its type’s length (see
tags::TYPED_NULL).
The two parameters:
Leafis the sealed leaf the cipher produces (Cipher::Leaf) — e.g.LocalCipherTextfor a local AES cipher, or an envelope leaf that additionally carries a wrapped data key.Pis the passthrough payload. For the sink-based path it is aPassthroughFrame:Nodeis this tree with that payload.
Only the Leaf type carries a byte-level format commitment (and should
implement serde where ciphertexts are persisted). The container itself
has no canonical byte representation: hosts project it onto their native
structures (a JS object tree, the Go binding’s transport codec), with
leaves as opaque byte strings.
Variants§
Single(Leaf)
A single sealed value.
Sequence(Vec<CipherText<Leaf, P>>)
A sequence of ciphertexts produced from a sequence-shaped plaintext.
EmptySequence(Leaf)
An empty sequence, authenticated under domain-separated AAD
(Context::for_empty_sequence)
by a marker leaf.
Map(Vec<(String, CipherText<Leaf, P>)>)
A map of (cleartext key, ciphertext value) pairs produced from a
map-shaped plaintext. Keys are stored in the clear but are bound into
each value’s AAD via Context::for_map_entry,
so they cannot be swapped or renamed undetected (passthrough entries
excepted).
EmptyMap(Leaf)
An empty map, authenticated under domain-separated AAD
(Context::for_empty_map) by a
marker leaf.
Passthrough(P)
A subtree passed through the container unencrypted and
unauthenticated. Non-sensitive data only — see
Sink::passthrough.