To generate an SSL (HTTPS) certificate using OpenSSL

Source: Internet
Author: User
Tags openssl rsa openssl x509

OpenSSL generates certificates

[Email protected] key]$ pwd
/app/nginx/key

    1. generate private key
      OpenSSL genrsa-out server.key 2048
    2. Generate certificate request
      OpenSSL Req-new-key server.key-out SERVER.CSR
    3. Fill in information
        [[email protected] key]$ OpenSSL req-new-key server.key-out server.csryou is about to B E asked to enter information that'll be incorporatedinto your certificate request. What's about-to-enter is called a distinguished Name or a DN. There is quite a few fields but can leave some blankfor some fields there would be a default value,if you enter '. ', t  He field would be a left blank.-----Country Name (2 letter code) [Xx]:cnstate or province name (full name) []:gdlocality name (eg, city) [Default city]:gzorganization name (eg, company) [Default company ltd]:aiorganizational Unit Name (eg, section) []:aicommo n name (eg, your Name or your server ' s hostname) []:112.96.28.206email Address []:  

Please enter the following ' extra ' attributes
To is sent with your certificate request
A Challenge Password []:
An optional company name []:
[Email protected] key]$
[[email protected] key]$ ls
Old SERVER.CSR Server.key

4. 备份一份服务器密钥文件cp server.key server.key.org5. 去除文件口令openssl rsa -in server.key.org -out server.key6. 生成证书文件server.crtopenssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

[email protected] key]$ OpenSSL rsa-in server.key.org-out server.key
Writing RSA Key
[Email protected] key]$
[email protected] key]$ OpenSSL x509-req-days 365-in server.csr-signkey server.key-out server.crt
Signature OK
subject=/c=cn/st=gd/l=gz/o=ai/ou=ai/cn=112.96.28.206
Getting Private Key

一般只需三步:1. openssl genrsa -out server.key 20482. openssl req -new -key server.key -out server.csr3. openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt关于密码:openssl genrsa -out server.key 2048    不需要密码。openssl genrsa -des3 -out server.key 2048    需要密码。https://www.jianshu.com/p/9523d888cf77关于域名:用openssl,域名可以不输;用keystore,必须输入。

To generate an SSL (HTTPS) certificate using OpenSSL

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.