Skip to content

Commit

Permalink
Merge pull request #75 from hatoo/add-common-name
Browse files Browse the repository at this point in the history
Add common-name to issued-to
  • Loading branch information
hatoo authored Nov 25, 2024
2 parents 777f264 + 6cef756 commit 72e3547
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 72e3547

Please sign in to comment.