Module x509_parser::pem[][src]

Decoding functions for PEM-encoded data

Examples

Parsing a certificate in DER format:

use x509_parser::pem::pem_to_der;

static IGCA_PEM: &'static [u8] = include_bytes!("../assets/IGC_A.pem");

let res = pem_to_der(IGCA_PEM);
match res {
    Ok((rem, pem)) => {
        assert!(rem.is_empty());
        //
        assert_eq!(pem.label, String::from("CERTIFICATE"));
    },
    _ => panic!("PEM parsing failed: {:?}", res),
}

Structs

Pem

Representation of PEM data

Functions

pem_to_der

Read a PEM-encoded structure, and decode the base64 data