MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / extract_subject_alt_names

Function extract_subject_alt_names

certbot/src/acme_client.rs:584–601  ·  view source on GitHub ↗
(cert_pem: &str)

Source from the content-addressed store, hash-verified

582}
583
584fn extract_subject_alt_names(cert_pem: &str) -> Result<Vec<String>> {
585 let pem = read_pem(cert_pem)?;
586 let cert = pem.parse_x509().context("Invalid x509 certificate")?;
587 let subject_alt_names = cert
588 .tbs_certificate
589 .subject_alternative_name()
590 .context("failed to parse subject alternative name")?
591 .context("no subject alternative name found")?;
592 let mut domains = Vec::new();
593 for name in &subject_alt_names.value.general_names {
594 if let GeneralName::DNSName(dns) = name {
595 domains.push(dns.to_string());
596 } else {
597 bail!("unsupported general name: {:?}", name);
598 }
599 }
600 Ok(domains)
601}
602
603fn ln_force(src: impl AsRef<Path>, dst: impl AsRef<Path>) -> Result<()> {
604 // Check if the symlink exists without following it

Callers 1

renew_certMethod · 0.85

Calls 1

read_pemFunction · 0.85

Tested by

no test coverage detected