strip_preamble

Function strip_preamble 

Source
pub(crate) fn strip_preamble(bytes: &[u8]) -> Result<&[u8]>
Expand description

Strip the “preamble”, i.e. data that appears before the PEM pre-encapsulation boundary.

Presently no attempt is made to ensure the preamble decodes successfully under any particular character encoding. The only byte which is disallowed is the NUL byte. This restriction does not appear in RFC7468, but rather is inspired by the OpenSSL PEM decoder.

Returns a slice which starts at the beginning of the encapsulated text.

From RFC7468:

Data before the encapsulation boundaries are permitted, and parsers MUST NOT malfunction when processing such data.