Skip to content

Commit

Permalink
Add common-name to issued-to
Browse files Browse the repository at this point in the history
  • Loading branch information
hatoo committed Nov 25, 2024
1 parent 777f264 commit 6cef756
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/tls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pub struct CertifiedKeyDer {
}

pub fn generate_cert(host: String, root_cert: &rcgen::CertifiedKey) -> CertifiedKeyDer {
let mut cert_params = rcgen::CertificateParams::new(vec![host]).unwrap();
let mut cert_params = rcgen::CertificateParams::new(vec![host.clone()]).unwrap();
cert_params
.key_usages
.push(rcgen::KeyUsagePurpose::DigitalSignature);
Expand All @@ -16,6 +16,11 @@ pub fn generate_cert(host: String, root_cert: &rcgen::CertifiedKey) -> Certified
cert_params
.extended_key_usages
.push(rcgen::ExtendedKeyUsagePurpose::ClientAuth);
cert_params.distinguished_name = {
let mut dn = rcgen::DistinguishedName::new();
dn.push(rcgen::DnType::CommonName, host);
dn
};

let key_pair = rcgen::KeyPair::generate().unwrap();

Expand Down

0 comments on commit 6cef756

Please sign in to comment.