File: print-trust-anchors.rs

package info (click to toggle)
rust-rustls-native-certs 0.8.1-5
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 312 kB
  • sloc: sh: 31; makefile: 5
file content (14 lines) | stat: -rw-r--r-- 477 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//! Print the Subject of all extracted trust anchors.

use std::error::Error;
use x509_parser::prelude::*;

fn main() -> Result<(), Box<dyn Error>> {
    for cert in rustls_native_certs::load_native_certs().expect("could not load platform certs") {
        match parse_x509_certificate(cert.as_ref()) {
            Ok((_, cert)) => println!("{}", cert.tbs_certificate.subject),
            Err(e) => eprintln!("error parsing certificate: {}", e),
        };
    }
    Ok(())
}