-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an example to print trust anchors.
- Loading branch information
Showing
2 changed files
with
16 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
//! Print the Subject of all extracted trust anchors. | ||
|
||
use rustls_native_certs; | ||
use std::error::Error; | ||
use x509_parser::prelude::*; | ||
|
||
fn main() -> Result<(), Box<dyn Error>> { | ||
for cert in rustls_native_certs::load_native_certs()? { | ||
match parse_x509_certificate(&cert.0) { | ||
Ok((_, cert)) => println!("{}", cert.tbs_certificate.subject), | ||
Err(e) => eprintln!("error parsing certificate: {}", e), | ||
}; | ||
} | ||
Ok(()) | ||
} |