#ssl-certificate #ssl #certificate #generate #openssl #rsa #key-file

easy_ssl

this is a rust lib to create x509 ssl certificate and private key file via an api and can be used in other rust projects

4 releases

0.0.4 Jan 9, 2020
0.0.3 Jan 9, 2020
0.0.2 Jan 9, 2020
0.0.1 Jan 9, 2020

#2057 in Cryptography

MIT license

19KB
412 lines

EASY SSL

this is a rust lib to create x509 ssl certificate and private key file via an api and can be used in other rust projects.

Installation

put the crate name and version in your cargo.toml file

easy_ssl = "0.0.4"

Usage


use easy_ssl::{builder,common,generate_as_files};

fn main(){

    let mut build = builder::Builder::new();

    build.set_key_path("D://workstation/expo/rust/fdb/cert/keys/key.pem".to_string());
    build.set_certificate_path("D://workstation/expo/rust/fdb/cert/keys/cert.pem".to_string());
    build.set_key_size(4048);

    build.issuer.set_country("IN".to_string());
    build.issuer.set_state("UP".to_string());
    build.issuer.set_location("GZB".to_string());
    build.issuer.set_org("DAACHI".to_string());
    build.issuer.set_common_name("https://daachi.in".to_string());

    build.subject.set_country("IN".to_string());
    build.subject.set_state("UP".to_string());
    build.subject.set_location("GZB".to_string());
    build.subject.set_org("DAACHI".to_string());
    build.subject.set_common_name("127.0.0.1".to_string());

    match generate_as_files(&mut build) {
        Ok(r)=>{
            println!("{:?}",r);
        },
        Err(e)=>{
            println!("erro : {:?}",e);
            common::error("failed-generate_as_vec");
        }
    }

}

License

MIT

Dependencies

~1.8–2.6MB
~59K SLoC