1.openssl genrsa -des3 -out test.demosoftware.com.key.enc 1024
2.openssl rsa -in test.demosoftware.com.key.enc -out test.demosoftware.com.key
3.openssl req -new -key test.demosoftware.com.key -out test.demosoftware.com.csr
4.openssl x509 -req -days 365 -in test.demosoftware.com.csr -signkey test.demosoftware.com.key -out test.demosoftware.com.crt
第三部详细:
[root@mail httpd]# openssl req -new -key test.demosoftware.com.key -out test.demosoftware.com.csr
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]:CN
State or Province Name (full name) []:BJ
Locality Name (eg, city) [Default City]:BJ
Organization Name (eg, company) [Default Company Ltd]:demosoftware
Organizational Unit Name (eg, section) []:demosoftware
Common Name (eg, your name or your server's hostname) []:mail.demosoftware.cn
Email Address []:ganlin_liu@demosoftware.com
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:admin
An optional company name []:demosoftware
生成不加密的
1.openssl genrsa -out <name of your certificate>.key 2048
2.openssl req -new -key <name of your certificate>.key -out <name of your certificate>.csr
转载于:https://blog.51cto.com/steven2/408709