From e0890a966171eb58b518660d8157359442efee95 Mon Sep 17 00:00:00 2001 From: Dorian Niemiec Date: Sun, 21 Dec 2025 11:17:34 +0100 Subject: [PATCH 1/2] chore: update dependencies to latest versions and adjust the code accordingly --- Cargo.toml | 10 +++++----- src/client.rs | 26 +++++++++++++++----------- test/ocsp_request.bin | Bin 88 -> 83 bytes 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 2f09309..9658500 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,9 +26,9 @@ chrono = "0.4" http = "1.3" itertools = { version = "0.14", optional = true } prometheus = { version = "0.14", optional = true } -rasn = "0.15" -rasn-ocsp = "0.15" -rasn-pkix = "0.15" +rasn = "0.28" +rasn-ocsp = "0.28" +rasn-pkix = "0.28" reqwest = { version = "0.12", default-features = false, features = [ "rustls-tls-webpki-roots-no-provider", "http2", @@ -41,10 +41,10 @@ tokio = { version = "1.44", features = ["full"] } tokio-util = { version = "0.7", features = ["full"] } tracing = "0.1" url = "2.5" -x509-parser = "0.16" +x509-parser = "0.18" [dev-dependencies] -hex-literal = "0.4" +hex-literal = "1.1" rustls-pemfile = "2" num-bigint = "0.4" httptest = "0.16" diff --git a/src/client.rs b/src/client.rs index 306f228..ce4627a 100644 --- a/src/client.rs +++ b/src/client.rs @@ -2,9 +2,9 @@ use std::time::Duration; use anyhow::{anyhow, Context, Error}; use base64::prelude::*; -use bytes::Bytes; use http::{header::CONTENT_TYPE, StatusCode}; -use rasn::types::Oid; +use num_bigint::BigInt; +use rasn::types::{OctetString, Oid}; use rasn_ocsp::{ BasicOcspResponse, CertId, CertStatus, OcspRequest, OcspResponse, OcspResponseStatus, Request, TbsRequest, Version, @@ -77,14 +77,15 @@ fn prepare_ocsp_request(cert: &[u8], issuer: &[u8]) -> Result<(OcspRequest, Url) }; // Calculate the hashes required for OCSP request - let issuer_name_hash = Bytes::copy_from_slice(Sha1::digest(cert.issuer.as_raw()).as_slice()); + let issuer_name_hash = OctetString::from_slice(Sha1::digest(cert.issuer.as_raw()).as_slice()); let issuer_key_hash = - Bytes::copy_from_slice(Sha1::digest(&issuer.public_key().subject_public_key).as_slice()); + OctetString::from_slice(Sha1::digest(&issuer.public_key().subject_public_key).as_slice()); // Prepare the request + let serial_number: BigInt = cert.serial.clone().into(); let req_cert = CertId { hash_algorithm, - serial_number: cert.serial.clone().into(), + serial_number: serial_number.into(), issuer_name_hash, issuer_key_hash, }; @@ -246,6 +247,7 @@ pub(crate) mod test { use hex_literal::hex; use httptest::{matchers::*, responders::*, Expectation, Server}; + use rasn::types::{Integer, OctetString}; use rustls::{crypto::ring, sign::CertifiedKey}; const OCSP_REQUEST: &[u8] = include_bytes!("../test/ocsp_request.bin"); @@ -265,16 +267,18 @@ pub(crate) mod test { .to_owned(), parameters: None, }, - issuer_name_hash: Bytes::from( + issuer_name_hash: OctetString::from( &hex!("36175FAA02C887BDD95CA13549512D1E97FADFA9")[..], ), - issuer_key_hash: Bytes::from( + issuer_key_hash: OctetString::from( &hex!("6691287B8D8654BAF6203197AEC491E9AFB70BCB")[..], ), - serial_number: num_bigint::BigInt::from_str( - "3819096869935823013274658159093914787918510", - ) - .unwrap(), + serial_number: Integer::from( + num_bigint::BigInt::from_str( + "3819096869935823013274658159093914787918510", + ) + .unwrap(), + ), }, single_request_extensions: None, }], diff --git a/test/ocsp_request.bin b/test/ocsp_request.bin index 5cb7efd6640bd485f18a1d7bee410dcdfad0c9bd..7c45ef257f9f7d1f072ed55263409b030293ddbd 100644 GIT binary patch delta 10 RcmazDW-$mf@Sn)(4*(7O0+|2+ delta 15 WcmWHJ;4}y`2wA|)#K Date: Sun, 21 Dec 2025 11:26:35 +0100 Subject: [PATCH 2/2] chore: remove unused `bytes` dependency --- Cargo.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 9658500..56fd2fc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,7 +21,6 @@ readme = "README.md" anyhow = "1.0" arc-swap = "1" base64 = "0.22" -bytes = "1.6" chrono = "0.4" http = "1.3" itertools = { version = "0.14", optional = true }