From 8b73b9a686054c571a9dc5e316f944486200882c Mon Sep 17 00:00:00 2001 From: Daniel McCarney Date: Fri, 16 Oct 2026 08:57:25 -0400 Subject: [PATCH 1/3] Avoid duplicate crypto providers Rustls uses aws-lc-rs by default, while rcgen is still using ring as default. Similarly, x509-parser w/ the base verification feature uses ring, but since this feature isn't in use we can drop it as opposed to switching to the aws-lc-rs backed verification feature. Instead of having a mix of both ring and aws-lc-rs, this commit standardizes on aws-lc-rs throughout. --- Cargo.lock | 17 ++++++++++++----- Cargo.toml | 8 ++++---- src/cert/parser.rs | 2 +- 3 files changed, 17 insertions(+), 10 deletions(-) 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..e22a43d 100644 --- a/src/cert/parser.rs +++ b/src/cert/parser.rs @@ -724,7 +724,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() From 48bb36e4ea905ed2ab46835fe989b046d722bf61 Mon Sep 17 00:00:00 2001 From: Daniel McCarney Date: Fri, 16 Oct 2026 10:39:51 -0400 Subject: [PATCH 2/3] cert: apply cargo fmt --- src/cert/parser.rs | 58 +++++++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 31 deletions(-) diff --git a/src/cert/parser.rs b/src/cert/parser.rs index e22a43d..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(), From 86d7d62dba6f3308a62a70134e0656e3f311c535 Mon Sep 17 00:00:00 2001 From: Daniel McCarney Date: Fri, 16 Oct 2026 10:40:19 -0400 Subject: [PATCH 3/3] output: fix clippy useless borrows finding Of the form: ``` warning: redundant reference in `format!` argument --> src/output/terminal.rs:98:41 | 98 | format!("{}{}{}", colors::CYAN, &empty, colors::RESET) | ^^^^^^ help: remove the redundant `&`: `empty` | = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.99.0/index.html#useless_borrows_in_formatting = note: `#[warn(clippy::useless_borrows_in_formatting)]` on by default ``` --- src/output/terminal.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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() });