Skip to content

Commit

Permalink
kbs_protocol: use rusttls when rust-crypto feature is enabled
Browse files Browse the repository at this point in the history
reqwest uses the platform's native TLS stack by default, also
when rusttls is enabled.

Force reqwest Client to use rustls TLS stack when rust-crypto
feature is enabled. This is what users most likely expect to
get.

Signed-off-by: Mikko Ylinen <[email protected]>
  • Loading branch information
mythi authored and jialez0 committed Aug 3, 2023
1 parent 562f1af commit a86a7ea
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions attestation-agent/kbs_protocol/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,10 @@ fn build_http_client(kbs_root_certs_pem: Vec<String>) -> Result<reqwest::Client>
client_builder = client_builder.add_root_certificate(cert);
}

if cfg!(feature = "rust-crypto") {
client_builder = client_builder.use_rustls_tls();
}

client_builder
.build()
.map_err(|e| anyhow!("Build KBS http client failed: {:?}", e))
Expand Down

0 comments on commit a86a7ea

Please sign in to comment.