struct Encapsulation<'a> {
label: &'a str,
encapsulated_text: &'a [u8],
}Expand description
PEM encapsulation parser.
This parser performs an initial pass over the data, locating the
pre-encapsulation (---BEGIN [...]---) and post-encapsulation
(---END [...]) boundaries while attempting to avoid branching
on the potentially secret Base64-encoded data encapsulated between
the two boundaries.
It only supports a single encapsulated message at present. Future work could potentially include extending it provide an iterator over a series of encapsulated messages.
Fields§
§label: &'a strType label extracted from the pre/post-encapsulation boundaries.
From RFC 7468 Section 2:
The type of data encoded is labeled depending on the type label in the “—–BEGIN “ line (pre-encapsulation boundary). For example, the line may be “—–BEGIN CERTIFICATE—–” to indicate that the content is a PKIX certificate (see further below). Generators MUST put the same label on the “—–END “ line (post-encapsulation boundary) as the corresponding “—–BEGIN “ line. Labels are formally case-sensitive, uppercase, and comprised of zero or more characters; they do not contain consecutive spaces or hyphen-minuses, nor do they contain spaces or hyphen-minuses at either end. Parsers MAY disregard the label in the post-encapsulation boundary instead of signaling an error if there is a label mismatch: some extant implementations require the labels to match; others do not.
encapsulated_text: &'a [u8]Encapsulated text portion contained between the boundaries.
This data should be encoded as Base64, however this type performs no validation of it so it can be handled in constant-time.
Implementations§
Trait Implementations§
Source§impl<'a> Clone for Encapsulation<'a>
impl<'a> Clone for Encapsulation<'a>
Source§fn clone(&self) -> Encapsulation<'a>
fn clone(&self) -> Encapsulation<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more