MCPcopy Create free account
hub / github.com/chirpstack/chirpstack / load_cert

Function load_cert

chirpstack/src/helpers/tls.rs:27–38  ·  view source on GitHub ↗
(cert_file: &str)

Source from the content-addressed store, hash-verified

25}
26
27pub async fn load_cert(cert_file: &str) -> Result<Vec<CertificateDer<'static>>> {
28 let cert_s = fs::read_to_string(cert_file)
29 .await
30 .context("Read TLS certificate")?;
31 let mut cert_b = cert_s.as_bytes();
32 let certs = rustls_pemfile::certs(&mut cert_b);
33 let mut out = Vec::new();
34 for cert in certs {
35 out.push(cert?.into_owned());
36 }
37 Ok(out)
38}
39
40pub async fn load_key(key_file: &str) -> Result<PrivateKeyDer<'static>> {
41 let key_s = fs::read_to_string(key_file)

Callers 3

newMethod · 0.85
setupFunction · 0.85
newMethod · 0.85

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected