Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ clap_complete = "4"
clap_mangen = "0.3"

# Certificate parsing & generation
x509-parser = { version = "0.18", features = ["verify"] }
rcgen = "0.14"
x509-parser = "0.18"
rcgen = { version = "0.14", default-features = false, features = ["aws_lc_rs", "pem"] }

# TLS
rustls = "0.23"
Expand All @@ -36,8 +36,8 @@ anyhow = "1"
# Base64 decoding
base64 = "0.23"

# SHA-256 (ring is already pulled in by rustls, just making it explicit)
ring = "0.17"
# SHA-256 (shared crypto implementation with rustls and rcgen)
aws-lc-rs = "1.18"

# Time (used by rcgen, shared dep)
time = "0.3"
Expand Down
60 changes: 28 additions & 32 deletions src/cert/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,37 +195,33 @@ fn parse_der_extension(e: &X509Extension) -> Option<(String, Vec<(String, String
within the extension
*/
match e.parsed_extension() {
ParsedExtension::AuthorityKeyIdentifier(authority_key_id) => {
Some((
"Authority key identifier".to_string(),
[
(
"Key identifier".to_string(),
match &authority_key_id.key_identifier {
None => "None".to_string(),
Some(id) => format_hex(id.0),
},
),
(
"Authority cert issuer".to_string(),
match &authority_key_id.authority_cert_issuer {
None => "None".to_string(),
Some(issuer) => {
String::from_iter(issuer.iter().map(|gn| gn.to_string()))
}
},
),
(
"Authority cert serial".to_string(),
match authority_key_id.authority_cert_serial {
None => "None".to_string(),
Some(serial) => format_hex(serial),
},
),
]
.to_vec(),
))
}
ParsedExtension::AuthorityKeyIdentifier(authority_key_id) => Some((
"Authority key identifier".to_string(),
[
(
"Key identifier".to_string(),
match &authority_key_id.key_identifier {
None => "None".to_string(),
Some(id) => format_hex(id.0),
},
),
(
"Authority cert issuer".to_string(),
match &authority_key_id.authority_cert_issuer {
None => "None".to_string(),
Some(issuer) => String::from_iter(issuer.iter().map(|gn| gn.to_string())),
},
),
(
"Authority cert serial".to_string(),
match authority_key_id.authority_cert_serial {
None => "None".to_string(),
Some(serial) => format_hex(serial),
},
),
]
.to_vec(),
)),
ParsedExtension::SubjectKeyIdentifier(key_id) => Some((
"Subject key identifier".to_string(),
[("Subject key id".to_string(), format_hex(key_id.0))].to_vec(),
Expand Down Expand Up @@ -724,7 +720,7 @@ fn base64_decode(input: &str) -> Result<Vec<u8>> {
}

fn sha256_hex(data: &[u8]) -> String {
use ring::digest;
use aws_lc_rs::digest;
let hash = digest::digest(&digest::SHA256, data);
hash.as_ref()
.iter()
Expand Down
2 changes: 1 addition & 1 deletion src/output/terminal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ fn render_cert_body(
box_chars::VERTICAL,
);
lines.push(if use_color {
format!("{}{}{}", colors::CYAN, &empty, colors::RESET)
format!("{}{}{}", colors::CYAN, empty, colors::RESET)
} else {
empty.clone()
});
Expand Down