diff --git a/s3/Cargo.toml b/s3/Cargo.toml index 33ea587..3d9a331 100644 --- a/s3/Cargo.toml +++ b/s3/Cargo.toml @@ -33,7 +33,7 @@ cfg-if = "1" chrono = "0.4" futures = { version = "0.3", optional = true } hex = "0.4" -hmac = "0.10" +hmac = "0.11" http = "0.2" log = "0.4" maybe-async = { version = "0.2" } diff --git a/s3/src/request_trait.rs b/s3/src/request_trait.rs index ea3aec1..7e63cdf 100644 --- a/s3/src/request_trait.rs +++ b/s3/src/request_trait.rs @@ -115,7 +115,7 @@ pub trait Request { } let canonical_request = self.presigned_canonical_request(&headers)?; let string_to_sign = self.string_to_sign(&canonical_request); - let mut hmac = signing::HmacSha256::new_varkey(&self.signing_key()?)?; + let mut hmac = signing::HmacSha256::new_from_slice(&self.signing_key()?)?; hmac.update(string_to_sign.as_bytes()); let signature = hex::encode(hmac.finalize().into_bytes()); // let signed_header = signing::signed_header_string(&headers); @@ -249,7 +249,7 @@ pub trait Request { fn authorization(&self, headers: &Headers) -> Result { let canonical_request = self.canonical_request(headers); let string_to_sign = self.string_to_sign(&canonical_request); - let mut hmac = signing::HmacSha256::new_varkey(&self.signing_key()?)?; + let mut hmac = signing::HmacSha256::new_from_slice(&self.signing_key()?)?; hmac.update(string_to_sign.as_bytes()); let signature = hex::encode(hmac.finalize().into_bytes()); let signed_header = signing::signed_header_string(headers); diff --git a/s3/src/signing.rs b/s3/src/signing.rs index 2f2017e..eb00d03 100644 --- a/s3/src/signing.rs +++ b/s3/src/signing.rs @@ -150,13 +150,13 @@ pub fn signing_key( service: &str, ) -> Result> { let secret = format!("AWS4{}", secret_key); - let mut date_hmac = HmacSha256::new_varkey(secret.as_bytes())?; + let mut date_hmac = HmacSha256::new_from_slice(secret.as_bytes())?; date_hmac.update(datetime.format(SHORT_DATE).to_string().as_bytes()); - let mut region_hmac = HmacSha256::new_varkey(&date_hmac.finalize().into_bytes())?; + let mut region_hmac = HmacSha256::new_from_slice(&date_hmac.finalize().into_bytes())?; region_hmac.update(region.to_string().as_bytes()); - let mut service_hmac = HmacSha256::new_varkey(®ion_hmac.finalize().into_bytes())?; + let mut service_hmac = HmacSha256::new_from_slice(®ion_hmac.finalize().into_bytes())?; service_hmac.update(service.as_bytes()); - let mut signing_hmac = HmacSha256::new_varkey(&service_hmac.finalize().into_bytes())?; + let mut signing_hmac = HmacSha256::new_from_slice(&service_hmac.finalize().into_bytes())?; signing_hmac.update(b"aws4_request"); Ok(signing_hmac.finalize().into_bytes().to_vec()) }