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

Function get_ca_cert

chirpstack/src/certificate.rs:37–57  ·  view source on GitHub ↗
(
    ca_cert_file: &str,
    ca_key_file: &str,
)

Source from the content-addressed store, hash-verified

35}
36
37async fn get_ca_cert(
38 ca_cert_file: &str,
39 ca_key_file: &str,
40) -> Result<(String, Issuer<'static, KeyPair>)> {
41 let ca_cert_s = fs::read_to_string(ca_cert_file)
42 .await
43 .context("Read gateway ca_cert")?;
44 let ca_key_s = fs::read_to_string(ca_key_file)
45 .await
46 .context("Read gateway ca_key")?;
47 let ca_key_s = private_key_to_pkcs8(&ca_key_s)?;
48 let ca_key_algo = read_algo(&ca_cert_s)?;
49
50 let ca_key =
51 KeyPair::from_pem_and_sign_algo(&ca_key_s, ca_key_algo).context("Parse gateway CA key")?;
52
53 Ok((
54 ca_cert_s.clone(),
55 Issuer::from_ca_cert_pem(&ca_cert_s, ca_key)?,
56 ))
57}
58
59// This returns the CA, certificate and private-key as PEM encoded strings.
60pub async fn client_cert_for_gateway_id(

Callers 2

Calls 2

private_key_to_pkcs8Function · 0.85
read_algoFunction · 0.85

Tested by

no test coverage detected