You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by xu...@apache.org on 2026/05/11 14:20:34 UTC
(opendal-reqsign) 01/01: Upgrade RustCrypto hash dependencies
This is an automated email from the ASF dual-hosted git repository.
Xuanwo pushed a commit to branch xuanwo/upgrade-rustcrypto
in repository https://gitbox.apache.org/repos/asf/opendal-reqsign.git
commit adee26401767ea7e7d5cf092c9d2c72d2b04cf4e
Author: Xuanwo <gi...@xuanwo.io>
AuthorDate: Mon May 11 22:20:14 2026 +0800
Upgrade RustCrypto hash dependencies
---
Cargo.toml | 6 +++---
core/src/hash.rs | 1 +
services/aws-v4/Cargo.toml | 4 ++--
services/aws-v4/src/provide_credential/sso.rs | 2 +-
services/google/Cargo.toml | 2 --
services/google/src/sign_request.rs | 2 +-
6 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/Cargo.toml b/Cargo.toml
index b4ecc99..7009b54 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -50,7 +50,7 @@ env_logger = "0.11"
form_urlencoded = "1"
futures = "0.3"
hex = "0.4"
-hmac = "0.12"
+hmac = "0.13"
http = "1"
jiff = "0.2"
jsonwebtoken = { version = "10", features = ["aws_lc_rs"] }
@@ -63,7 +63,7 @@ rsa = { version = "0.9.2", features = ["pkcs5", "sha2"] }
rust-ini = { version = "0.21" }
serde = { version = "1", features = ["derive"] }
serde_json = { version = "1" }
-sha1 = "0.10"
-sha2 = { version = "0.10", features = ["oid"] }
+sha1 = "0.11"
+sha2 = { version = "0.11", features = ["oid"] }
tempfile = "3.8"
tokio = { version = "1", default-features = false }
diff --git a/core/src/hash.rs b/core/src/hash.rs
index fda4e97..7300d8d 100644
--- a/core/src/hash.rs
+++ b/core/src/hash.rs
@@ -21,6 +21,7 @@ use crate::Error;
use base64::Engine;
use base64::prelude::BASE64_STANDARD;
use hmac::Hmac;
+use hmac::KeyInit;
use hmac::Mac;
use sha1::Sha1;
use sha2::Digest;
diff --git a/services/aws-v4/Cargo.toml b/services/aws-v4/Cargo.toml
index 6fbe723..e5f867b 100644
--- a/services/aws-v4/Cargo.toml
+++ b/services/aws-v4/Cargo.toml
@@ -34,6 +34,7 @@ name = "aws"
anyhow = { workspace = true }
bytes = "1.7.2"
form_urlencoded = { workspace = true }
+hex = { workspace = true }
http = { workspace = true }
log = { workspace = true }
percent-encoding = { workspace = true }
@@ -43,7 +44,7 @@ rust-ini = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
serde_urlencoded = "0.7"
-sha1 = "0.10"
+sha1 = { workspace = true }
[dev-dependencies]
aws-credential-types = "1.1.8"
@@ -51,7 +52,6 @@ aws-sigv4 = "1.2.0"
criterion = { workspace = true }
dotenvy = { workspace = true }
env_logger = { workspace = true }
-hex = { workspace = true }
pretty_assertions = { workspace = true }
reqsign-http-send-reqwest = { workspace = true }
reqwest = { workspace = true, features = ["default-tls"] }
diff --git a/services/aws-v4/src/provide_credential/sso.rs b/services/aws-v4/src/provide_credential/sso.rs
index ccc1968..9fb6f28 100644
--- a/services/aws-v4/src/provide_credential/sso.rs
+++ b/services/aws-v4/src/provide_credential/sso.rs
@@ -365,7 +365,7 @@ fn hex_sha1(data: &[u8]) -> String {
use sha1::{Digest, Sha1};
let mut hasher = Sha1::new();
hasher.update(data);
- format!("{:x}", hasher.finalize())
+ hex::encode(hasher.finalize())
}
#[cfg(test)]
diff --git a/services/google/Cargo.toml b/services/google/Cargo.toml
index 88f8054..8f6dd01 100644
--- a/services/google/Cargo.toml
+++ b/services/google/Cargo.toml
@@ -37,7 +37,6 @@ reqsign-core = { workspace = true }
rsa = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
-sha2 = { workspace = true }
tokio = { workspace = true, features = ["time"] }
[dev-dependencies]
@@ -47,5 +46,4 @@ env_logger = { workspace = true }
reqsign-file-read-tokio = { workspace = true }
reqsign-http-send-reqwest = { workspace = true }
reqwest = { workspace = true, features = ["default-tls"] }
-sha2 = { workspace = true }
tokio = { workspace = true, features = ["full"] }
diff --git a/services/google/src/sign_request.rs b/services/google/src/sign_request.rs
index 8f594cd..e6d0c2f 100644
--- a/services/google/src/sign_request.rs
+++ b/services/google/src/sign_request.rs
@@ -247,7 +247,7 @@ impl RequestSigner {
let private_key = rsa::RsaPrivateKey::from_pkcs8_pem(private_key_pem).map_err(|e| {
reqsign_core::Error::unexpected("failed to parse private key").with_source(e)
})?;
- let signing_key = SigningKey::<sha2::Sha256>::new(private_key);
+ let signing_key = SigningKey::<rsa::sha2::Sha256>::new(private_key);
let signature = signing_key.sign_with_rng(&mut rng, string_to_sign.as_bytes());
Ok(signature.to_string())