diff --git a/Cargo.lock b/Cargo.lock index f8aa65a..cfef0ac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -110,6 +110,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b281d307588d634de920874890732659e2e7672f72b5e10e81badc1a8a83621e" dependencies = [ "aws-lc-sys", + "untrusted 0.7.1", "zeroize", ] @@ -645,8 +646,8 @@ version = "0.14.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8774e05a7d0de114588e6a28fe7e71694b82614ed569d86d8b389dfbc98b8ad8" dependencies = [ + "aws-lc-rs", "pem", - "ring", "rustls-pki-types", "time", "x509-parser", @@ -663,7 +664,7 @@ dependencies = [ "cfg-if", "getrandom 0.2.17", "libc", - "untrusted", + "untrusted 0.9.0", "windows-sys 0.52.0", ] @@ -728,7 +729,7 @@ dependencies = [ "aws-lc-rs", "ring", "rustls-pki-types", - "untrusted", + "untrusted 0.9.0", ] [[package]] @@ -796,13 +797,13 @@ name = "sslx" version = "0.4.0" dependencies = [ "anyhow", + "aws-lc-rs", "base64", "clap", "clap_complete", "clap_mangen", "p12", "rcgen", - "ring", "rustls", "serde", "serde_json", @@ -932,6 +933,12 @@ version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + [[package]] name = "untrusted" version = "0.9.0" @@ -1075,12 +1082,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d43b0f71ce057da06bc0851b23ee24f3f86190b07203dd8f567d0b706a185202" dependencies = [ "asn1-rs", + "aws-lc-rs", "data-encoding", "der-parser", "lazy_static", "nom", "oid-registry", - "ring", "rusticata-macros", "thiserror", "time", diff --git a/Cargo.toml b/Cargo.toml index 672bb39..dbaa6ad 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" @@ -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" diff --git a/src/cert/parser.rs b/src/cert/parser.rs index 103887f..3f090c8 100644 --- a/src/cert/parser.rs +++ b/src/cert/parser.rs @@ -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(), @@ -724,7 +720,7 @@ fn base64_decode(input: &str) -> Result> { } 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() diff --git a/src/output/terminal.rs b/src/output/terminal.rs index 3e6786f..0aad651 100644 --- a/src/output/terminal.rs +++ b/src/output/terminal.rs @@ -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() });