Function acme_rs::generate_cert_for_domain[][src]

pub fn generate_cert_for_domain<T: AsRef<str>>(
    keypair_for_cert: &(Rsa<Private>, Rsa<Public>),
    domain: T,
    server: T,
    email: T,
    verbose: bool
) -> Result<String, Error>

Generates a certificate for a certain domain. This method contains the logic for communicating with the server in order to authenticate for the certificate. The keypair that’s passed to this method is used to sign the certificate signing request (CSR).

Example

use acme_rs::{generate_cert_for_domain, util::{generate_rsa_keypair, save_certificates, save_keypair}};

// create a keypair and request the certificate for it
let keypair = generate_rsa_keypair().expect("Error during key creation");
let cert_chain = generate_cert_for_domain(
           &keypair,
           "www.example.org",
           "https://acme-v02.api.letsencrypt.org/directory",
           "max@mustermann.de",
           false,
       ).expect("Error while requesting the certificate.")

// save the certificate in two files called my_cert.crt and cert_chain.crt
save_certificates(cert_chain).expect("Unable to save certificate");