encoding::pem+x86_64 +linux
pem: RFC 7468 (PEM) encoding support
The PEM module implements RFC 7468, commonly known as the PEM format, which is widely used for cryptographic data formats.
Index
Types
// Undocumented types: type b64stream; type decoder; type pemdecoder; type pemencoder;
Functions
fn finish(dec: *decoder) void; fn newdecoder(in: io::handle) decoder; fn newencoder(label: str, s: io::handle) (pemencoder | io::error); fn next(dec: *decoder) ((str, pemdecoder) | io::EOF | io::error); fn strerror(err: io::error) str;
Types
type b64stream[permalink] [source]
Show undocumented member
type b64stream = struct { stream: io::stream, in: bufio::scanner, };
type decoder[permalink] [source]
Show undocumented member
type decoder = struct { in: b64stream, label: memio::stream, };
type pemdecoder[permalink] [source]
Show undocumented member
type pemdecoder = struct { stream: io::stream, b64: base64::decoder, };
type pemencoder[permalink] [source]
Show undocumented member
type pemencoder = struct { stream: io::stream, out: io::handle, b64: base64::encoder, label: str, buf: [48]u8, ln: u8, };
Functions
fn finish[permalink] [source]
fn finish(dec: *decoder) void;
Frees state associated with this decoder.
fn newdecoder[permalink] [source]
fn newdecoder(in: io::handle) decoder;
Creates a new PEM decoder. The caller must either read it until it returns io::EOF, or call finish to free state associated with the parser.
fn newencoder[permalink] [source]
fn newencoder(label: str, s: io::handle) (pemencoder | io::error);
Creates a new PEM encoder stream. The stream has to be closed to write the trailer.
fn next[permalink] [source]
fn next(dec: *decoder) ((str, pemdecoder) | io::EOF | io::error);
Finds the next PEM boundary in the stream, ignoring any non-PEM data, and returns the label and a pemdecoder from which the encoded data may be read, or io::EOF if no further PEM boundaries are found. The user must completely read the pemdecoder until it returns io::EOF before calling next again.
The label returned by this function is borrowed from the decoder state and does not contain "-----BEGIN " or "-----".
fn strerror[permalink] [source]
fn strerror(err: io::error) str;
Converts an I/O error returned from a PEM decoder into a human-friendly string.