openssl生成证书

2019-03-21 16:33:09       xhs
[root@to8to cert]# openssl genrsa -des3 -out pc_xiaohuasheng_com.key 1024
Generating RSA private key, 1024 bit long modulus
............++++++
...........................................................++++++
e is 65537 (0x10001)
Enter pass phrase for pc_xiaohuasheng_com.key:
Verifying - Enter pass phrase for pc_xiaohuasheng_com.key:
[root@to8to cert]# ls
pc_xiaohuasheng_com.key
[root@to8to cert]# openssl req -new -key pc_xiaohuasheng_com.key -out pc_xiaohuasheng_com.csr
Enter pass phrase for pc_xiaohuasheng_com.key:
You are about to be asked to enter information that will be incorporated
into 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) [XX]:ZH
State or Province Name (full name) []:GUANGDONG
Locality Name (eg, city) [Default City]:SHENZHEN
Organization Name (eg, company) [Default Company Ltd]:to8to
Organizational Unit Name (eg, section) []:to8to
Common Name (eg, your name or your server's hostname) []:www.xiaohuasheng.com
Email Address []:watson.zeng@corp.to8to.com

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
[root@to8to cert]# openssl rsa -in pc_xiaohuasheng_com.key -out pc_xiaohuasheng_com_nopwd.key
Enter pass phrase for pc_xiaohuasheng_com.key:
writing RSA key
[root@to8to cert]# vim pc_xiaohuasheng.ext
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
subjectAltName = @alt_names

[alt_names]
DNS.1 = www.xiaohuasheng.com

[root@to8to cert]# 
[root@to8to cert]# 
[root@to8to cert]# openssl x509 -req -days 365 -in pc_xiaohuasheng_com.csr -signkey pc_xiaohuasheng_com_nopwd.key -out pc_xiaohuasheng_com_https.crt -sha256  -extfile pc_xiaohuasheng.ext 
Signature ok
subject=/C=ZH/ST=GUANGDONG/L=SHENZHEN/O=to8to/OU=to8to/CN=www.xiaohuasheng.com/emailAddress=watson.zeng@corp.to8to.com
Getting Private key
[root@to8to cert]# 


发表评论