10
10
//! information on licensing and copyright.
11
11
12
12
use anyhow:: { anyhow, Result as AnyhowResult } ;
13
- use base64;
13
+ use base64:: { Engine , engine :: general_purpose :: STANDARD as b64_engine } ;
14
14
use err_derive:: Error ;
15
15
use log:: { error, info} ;
16
16
use std:: collections:: HashMap ;
@@ -74,8 +74,8 @@ pub fn complete_proxy_attestation_nitro(
74
74
) -> AnyhowResult < Vec < u8 > > {
75
75
let url = format ! ( "http://{:}/proxy/v1/Nitro/{:}" , proxy_attestation_server_url, challenge_id) ;
76
76
let mut form_fields: HashMap < String , String > = HashMap :: new ( ) ;
77
- form_fields. insert ( "token" . to_string ( ) , base64 :: encode ( att_doc) ) ;
78
- form_fields. insert ( "csr" . to_string ( ) , base64 :: encode ( csr) ) ;
77
+ form_fields. insert ( "token" . to_string ( ) , b64_engine . encode ( att_doc) ) ;
78
+ form_fields. insert ( "csr" . to_string ( ) , b64_engine . encode ( csr) ) ;
79
79
80
80
let response = http:: post_form ( url, & form_fields)
81
81
. map_err ( |err| ProxyAttestationClientError :: HttpError ( err) ) ?;
@@ -93,8 +93,8 @@ pub fn complete_proxy_attestation_linux(
93
93
) -> AnyhowResult < Vec < u8 > > {
94
94
let url = format ! ( "http://{:}/proxy/v1/PSA/{:}" , proxy_attestation_server_url, challenge_id) ;
95
95
let mut form_fields: HashMap < String , String > = HashMap :: new ( ) ;
96
- form_fields. insert ( "token" . to_string ( ) , base64 :: encode ( token) ) ;
97
- form_fields. insert ( "csr" . to_string ( ) , base64 :: encode ( csr) ) ;
96
+ form_fields. insert ( "token" . to_string ( ) , b64_engine . encode ( token) ) ;
97
+ form_fields. insert ( "csr" . to_string ( ) , b64_engine . encode ( csr) ) ;
98
98
99
99
let response = http:: post_form ( url, & form_fields)
100
100
. map_err ( |err| ProxyAttestationClientError :: HttpError ( err) ) ?;
0 commit comments