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

Function client_cert_for_application_id

chirpstack/src/certificate.rs:76–95  ·  view source on GitHub ↗
(
    application_id: &Uuid,
)

Source from the content-addressed store, hash-verified

74}
75
76pub async fn client_cert_for_application_id(
77 application_id: &Uuid,
78) -> Result<(SystemTime, String, String, String)> {
79 let conf = config::get();
80 let (ca_cert, ca_issuer) = get_ca_cert(
81 &conf.integration.mqtt.client.ca_cert,
82 &conf.integration.mqtt.client.ca_key,
83 )
84 .await?;
85 let not_before = SystemTime::now();
86 let not_after = SystemTime::now() + conf.integration.mqtt.client.client_cert_lifetime;
87 let (app_cert, app_key) = gen_client_cert(
88 &application_id.to_string(),
89 not_before,
90 not_after,
91 &ca_issuer,
92 )?;
93
94 Ok((not_after, ca_cert, app_cert.pem(), app_key.serialize_pem()))
95}
96
97// we are using String here, because else we run into lifetime issues.
98fn read_algo(cert: &str) -> Result<&'static SignatureAlgorithm> {

Calls 4

get_ca_certFunction · 0.85
gen_client_certFunction · 0.85
to_stringMethod · 0.80
getFunction · 0.70

Tested by

no test coverage detected