(
application_id: &Uuid,
)
| 74 | } |
| 75 | |
| 76 | pub 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. |
| 98 | fn read_algo(cert: &str) -> Result<&'static SignatureAlgorithm> { |
no test coverage detected