11use crate :: headers:: CONTENT_MD5 ;
22use crate :: {
33 core:: { ConnectionString , No } ,
4+ hmac:: sign,
45 shared_access_signature:: account_sas:: {
56 AccountSharedAccessSignatureBuilder , ClientAccountSharedAccessSignature ,
67 } ,
@@ -13,7 +14,6 @@ use http::{
1314 method:: Method ,
1415 request:: { Builder , Request } ,
1516} ;
16- use ring:: hmac;
1717use std:: sync:: Arc ;
1818use url:: Url ;
1919
@@ -450,22 +450,12 @@ fn generate_authorization(
450450 // debug!("\nstr_to_sign == {:?}\n", str_to_sign);
451451 // debug!("str_to_sign == {}", str_to_sign);
452452
453- let auth = encode_str_to_sign ( & str_to_sign, key) ;
453+ let auth = sign ( & str_to_sign, key) . unwrap ( ) ;
454454 // debug!("auth == {:?}", auth);
455455
456456 format ! ( "SharedKey {}:{}" , account, auth)
457457}
458458
459- fn encode_str_to_sign ( str_to_sign : & str , hmac_key : & str ) -> String {
460- let key = hmac:: Key :: new ( ring:: hmac:: HMAC_SHA256 , & base64:: decode ( hmac_key) . unwrap ( ) ) ;
461- let sig = hmac:: sign ( & key, str_to_sign. as_bytes ( ) ) ;
462-
463- // let res = hmac.result();
464- // debug!("{:?}", res.code());
465-
466- base64:: encode ( sig. as_ref ( ) )
467- }
468-
469459fn add_if_exists < K : AsHeaderName > ( h : & HeaderMap , key : K ) -> & str {
470460 match h. get ( key) {
471461 Some ( ce) => ce. to_str ( ) . unwrap ( ) ,
0 commit comments