openssl req -new -newkey rsa:2048 -sha256 -nodes -out mycompany_com.csr -keyout mycompany_com.key -subj “/C=US/ST=NY/L=Company City/O=My Company/CN=mycompany.com”

Filling out the form and hit generate and save you CSR

openssl req -x509 -key mycompany_com.key -in mycompany_com.csr -out mycompany_com.pem -days 365 -set_serial 1

It is also possible to define subject alternative names

openssl req -new -newkey rsa:2048 -sha256 -nodes -out foobar_root_g1.csr -keyout foobar_root_g1.key -subj “/C=US/ST=NY/L=Foo Bar City/O=Foo Bar Authority/CN=Foo Bar Authority Root G1”

openssl req -x509 -key foobar_root_g1.key -in foobar_root_g1.csr -out foobar_root_g1.pem -days 365

[ ca ]
default_ca = CA_default # The default ca section

[ CA_default ]

dir = foobar_authority # top dir
database = $dir/index.txt # index file.
new_certs_dir = $dir/newcerts # new certs dir

certificate = $dir/cacert.pem # The CA cert
serial = $dir/serial # serial no file
rand_serial = yes
private_key = $dir/private/cakey.pem# CA private key
RANDFILE = $dir/private/.rand # random number file

default_days = 365 # how long to certify for
default_crl_days= 30 # how long before next CRL
default_md = md5 # md to use

policy = policy_any # default policy
email_in_dn = no # Don’t add the email into cert DN

name_opt = ca_default # Subject name display option
cert_opt = ca_default # Certificate display option
copy_extensions = none # Don’t copy extensions from request

[ policy_any ]
countryName = supplied
stateOrProvinceName = optional
organizationName = optional
organizationalUnitName = optional
commonName = supplied
emailAddress = optional

// Directories
mkdir foobar_authority
mkdir foobar_authority/newcerts

// Files
touch foobar_authority/index.txt
touch foobar_authority/serial

// Insert content to serial file
echo 00 > foobar_authority/serial

openssl ca -keyfile foobar_root_g1.key -in mycompany_com.csr -out mycompany_com.pem -days 365 -cert foobar_root_g1.pem -config ca.config

About SSL Toolkit

Logo

CI/CD社区为您提供最前沿的新闻资讯和知识内容

更多推荐