pub fn gen_self_signed_certificate(hostname: &str) -> X509 {
    let mut x509_name = X509NameBuilder::new().unwrap();
    x509_name.append_entry_by_text("C", "AU").unwrap();
    x509_name.append_entry_by_text("ST", "Woo").unwrap();
    x509_name
        .append_entry_by_text("O", "Example organization")
        .unwrap();
    x509_name.append_entry_by_text("CN", &hostname).unwrap();
    let x509_name = x509_name.build();

    let mut x509 = X509::builder().unwrap();
    x509.set_subject_name(&x509_name).unwrap();

    x509.build()
}
/// generates a really terrible self-signed certificate for testing purposes
generates a really terrible self-signed certificate for testing purposes
generates a really terrible self - signed certificate for testing purposes
pub fn gen_self_signed_certificate(hostname: &str) -> X509 {
    let mut x509_name = X509NameBuilder::new().unwrap();
    x509_name.append_entry_by_text("C", "AU").unwrap();
    x509_name.append_entry_by_text("ST", "Woo").unwrap();
    x509_name
        .append_entry_by_text("O", "Example organization")
        .unwrap();
    x509_name.append_entry_by_text("CN", &hostname).unwrap();
    let x509_name = x509_name.build();
    let mut x509 = X509::builder().unwrap();
    x509.set_subject_name(&x509_name).unwrap();
    x509.build()
}
pub fn gen_self_signed_certificate ( hostname : & str ) -> X509 { let mut x509_name = X509NameBuilder :: new ( ) . unwrap ( ) ; x509_name . append_entry_by_text ( " " , " " ) . unwrap ( ) ; x509_name . append_entry_by_text ( " " , " " ) . unwrap ( ) ; x509_name . append_entry_by_text ( " " , " " ) . unwrap ( ) ; x509_name . append_entry_by_text ( " " , & hostname ) . unwrap ( ) ; let x509_name = x509_name . build ( ) ; let mut x509 = X509 :: builder ( ) . unwrap ( ) ; x509 . set_subject_name ( & x509_name ) . unwrap ( ) ; x509 . build ( ) }
generates a really terrible self-signed certificate for testing purposes
generates a really terrible self - signed certificate for testing purposes
hostname
&str
hostname
&str