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)
134pub fn main() -> io::Result<()> {
135 for file_name in env::args().skip(1) {
136 // placeholder to store decoded PEM data, if needed
137 let tmpdata;
138
139 println!("File: {}", file_name);
140 let data = std::fs::read(file_name.clone()).expect("Unable to read file");
141 let der_data: &[u8] = if (data[0], data[1]) == (0x30, 0x82) {
142 // probably DER
143 &data
144 } else {
145 // try as PEM
146 let (_, data) = parse_x509_pem(&data).expect("Could not decode the PEM file");
147 tmpdata = data;
148 &tmpdata.contents
149 };
150 let (_, crl) = parse_x509_crl(der_data).expect("Could not decode DER data");
151 print_crl_info(&crl);
152 }
153 Ok(())
154}