pub fn parse_x509_crl(i: &[u8]) -> X509Result<'_, CertificateRevocationList<'_>>
Expand description

Parse a DER-encoded X.509 v2 CRL, and return the remaining of the input and the built object.

This function is an alias to CertificateRevocationList::from_der. See this function for more information.

Examples found in repository?
examples/print-crl.rs (line 150)
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
pub fn main() -> io::Result<()> {
    for file_name in env::args().skip(1) {
        // placeholder to store decoded PEM data, if needed
        let tmpdata;

        println!("File: {}", file_name);
        let data = std::fs::read(file_name.clone()).expect("Unable to read file");
        let der_data: &[u8] = if (data[0], data[1]) == (0x30, 0x82) {
            // probably DER
            &data
        } else {
            // try as PEM
            let (_, data) = parse_x509_pem(&data).expect("Could not decode the PEM file");
            tmpdata = data;
            &tmpdata.contents
        };
        let (_, crl) = parse_x509_crl(der_data).expect("Could not decode DER data");
        print_crl_info(&crl);
    }
    Ok(())
}