OPENSSL签发自签名SSL证书

碎碎の念 2021-08-14 0℃ 0 0

准备步骤

生成私钥

openssl genrsa -out ./self.key 2048

生成 CSR 文件

信息随便填写一下,注意把xiamp.net换成你的域名

openssl req -new -key ./self.key -out ./self.csr
You are about to be asked to enter information that will be incorporatedinto your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:CN
State or Province Name (full name) [Some-State]:
Locality Name (eg, city) []:BeiJing
Organization Name (eg, company) [Internet Widgits Pty Ltd]:KKP LLC
Organizational Unit Name (eg, section) []:MANTOUBAO
Common Name (e.g. server FQDN or YOUR name) []:xiamp.netEmail Address []:
Please enter the following 'extra' attributesto be sent with your certificate request
A challenge password []:
An optional company name []:

生成自签名证书

openssl x509 -req -days 3650 -in ./self.csr -signkey ./self.key -out ./self.crt
Signature oksubject=C = CN, ST = Some-State, L = BeiJing, O = KKP LLC, OU = MANTOUBAO, CN = xiamp.net
Getting Private key

评论 (0)

Top