pem_rfc7468

Function encapsulated_len_wrapped

Source
pub fn encapsulated_len_wrapped(
    label: &str,
    line_width: usize,
    line_ending: LineEnding,
    input_len: usize,
) -> Result<usize>
Expand description

Compute the length of a PEM encoded document with the Base64 body line wrapped at the specified width.

This is the same as encapsulated_len, which defaults to a width of 64.

Note that per RFC7468 ยง 2 encoding PEM with any other wrap width besides 64 is technically non-compliant:

Generators MUST wrap the base64-encoded lines so that each line consists of exactly 64 characters except for the final line, which will encode the remainder of the data (within the 64-character line boundary)