MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / build_tls_root

Function build_tls_root

crates/openshell-server/tests/common/mod.rs:637–647  ·  view source on GitHub ↗

Parse PEM cert bytes into a `RootCertStore`.

(cert_pem: &[u8])

Source from the content-addressed store, hash-verified

635
636/// Parse PEM cert bytes into a `RootCertStore`.
637pub fn build_tls_root(cert_pem: &[u8]) -> RootCertStore {
638 let mut roots = RootCertStore::empty();
639 let mut cursor = std::io::Cursor::new(cert_pem);
640 let parsed = certs(&mut cursor)
641 .collect::<Result<Vec<CertificateDer<'static>>, _>>()
642 .expect("failed to parse cert pem");
643 for cert in parsed {
644 roots.add(cert).expect("failed to add cert");
645 }
646 roots
647}
648
649/// Build a gRPC client with mTLS (CA + client cert).
650pub async fn grpc_client_mtls(

Callers 3

https_client_mtlsFunction · 0.85
https_client_no_certFunction · 0.85
https_client_mtlsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected