File tree 1 file changed +19
-0
lines changed
1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -103,3 +103,22 @@ pub fn complete_proxy_attestation_linux(
103
103
_ => return Err ( anyhow ! ( ProxyAttestationClientError :: BadResponse ) ) ,
104
104
}
105
105
}
106
+
107
+ pub fn complete_proxy_attestation_sev (
108
+ proxy_attestation_server_url : & str ,
109
+ report : & [ u8 ] ,
110
+ csr : & [ u8 ] ,
111
+ challenge_id : Uuid ,
112
+ ) -> AnyhowResult < Vec < u8 > > {
113
+ let url = format ! ( "http://{:}/proxy/v1/SEV/{:}" , proxy_attestation_server_url, challenge_id) ;
114
+ let mut form_fields: HashMap < String , String > = HashMap :: new ( ) ;
115
+ form_fields. insert ( "token" . to_string ( ) , base64:: encode ( report) ) ;
116
+ form_fields. insert ( "csr" . to_string ( ) , base64:: encode ( csr) ) ;
117
+
118
+ let response = http:: post_form ( url, & form_fields)
119
+ . map_err ( |err| ProxyAttestationClientError :: HttpError ( err) ) ?;
120
+ match response {
121
+ http:: HttpResponse :: Ok ( data) => return Ok ( data) ,
122
+ _ => return Err ( anyhow ! ( ProxyAttestationClientError :: BadResponse ) ) ,
123
+ }
124
+ }
You can’t perform that action at this time.
0 commit comments