Expand description
Helper functions and rules for enforcing the ABNF grammar for RFC 7468-flavored PEM as described in Section 3.
The grammar described below is intended to follow the βABNF (Strict)β subset of the grammar as described in Section 3 Figure 3.
ConstantsΒ§
- CHAR_
COLON π - Colon β:β
- CHAR_CR π
- Carriage return
- CHAR_HT π
- Horizontal tab
- CHAR_LF π
- Line feed
- CHAR_
NUL π - NUL char
- CHAR_SP π
- Space
FunctionsΒ§
- is_
allowed_ πin_ label - Does the provided byte match a character allowed in a label?
- is_
labelchar π - Any printable character except hyphen-minus, as defined in the βlabelcharβ production in the RFC 7468 ABNF grammar
- is_wsp π
- Does the provided byte match the βWSPβ ABNF production from Section 3?
- split_
label π - Split a slice beginning with a type label as located in an encapsulation
boundary. Returns the label as a
&str, and slice beginning with the encapsulated text with leading-----and newline removed. - strip_
leading_ πeol - Strip a newline (
eol) from the beginning of the provided byte slice. - strip_
preamble π - Strip the βpreambleβ, i.e. data that appears before the PEM pre-encapsulation boundary.
- strip_
trailing_ πeol - Strip a newline (
eol) from the end of the provided byte slice. - validate_
label π - Validate that the given bytes are allowed as a PEM type label, i.e. the
label encoded in the
BEGINandENDencapsulation boundaries.