pub struct Transcript { /* private fields */ }Expand description
Bytes prepared for signing or MAC computation, with a mandatory domain label.
Implementations§
Source§impl Transcript
impl Transcript
Sourcepub fn new(label: Label) -> Self
pub fn new(label: Label) -> Self
Begin a transcript with a domain label.
The label has type Label, not &'static [u8], a substantive
difference: a Label cannot be invented; only constants in
crate::label supply it. When bytes were accepted, I-12 checks
inspected the registry while a caller could bypass it with a string
absent from the registry (for example an extension of an occupied label), invisible to
every probe. That no longer compiles.
Sourcepub fn u8(&mut self, value: u8) -> &mut Self
pub fn u8(&mut self, value: u8) -> &mut Self
Append one byte: algorithm identifier, version, tag.
Sourcepub fn u32le(&mut self, value: u32) -> &mut Self
pub fn u32le(&mut self, value: u32) -> &mut Self
Append a little-endian u32. Order is specified by the format.
Sourcepub fn u32be(&mut self, value: u32) -> &mut Self
pub fn u32be(&mut self, value: u32) -> &mut Self
Append a big-endian u32, used for chunk indices.
Sourcepub fn u64be(&mut self, value: u64) -> &mut Self
pub fn u64be(&mut self, value: u64) -> &mut Self
Append a big-endian u64, used for lease sequences.
Sourcepub fn fixed(&mut self, value: &[u8]) -> &mut Self
pub fn fixed(&mut self, value: &[u8]) -> &mut Self
Append fixed-length data: key, fingerprint, identifier.
For variable-length fields use Transcript::field, or
two different field sequences can produce identical bytes and the signature
ceases to identify contents unambiguously.
Sourcepub fn field(&mut self, value: &[u8]) -> &mut Self
pub fn field(&mut self, value: &[u8]) -> &mut Self
Append a variable-length field with a length prefix.
Sourcepub fn tail_after_declared_length(&mut self, value: &[u8]) -> &mut Self
pub fn tail_after_declared_length(&mut self, value: &[u8]) -> &mut Self
Append a final block without a length prefix.
Permitted only when its length was already written into the transcript,
as in a header signature, where u32le(HeaderLen) precedes
the header itself.