$ openssl genrsa -des3 -out root.key 2048 Generating RSA private key, 2048 bit long modulus ..............................................................+++ ................+++ e is 65537 (0x010001) Enter pass phrase for root.key:
Verifying - Enter pass phrase for root.key:
生成 ca 证书,自签 20 年有效期,并将此 ca 证书导入需要访问的 PC 的“受信任的根证书颁发机构”中,后续用此 ca 签署的证书均可正常使用:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
$ openssl req -x509 -new -nodes -key root.key -sha256 -days 7300 -out root.crt Enter pass phrase for root.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) [AU]:CN # 国家 State or Province Name (full name) [Some-State]:SiChuan # 省份 Locality Name (eg, city) []:ChengDu # 城市 Organization Name (eg, company) [Internet Widgits Pty Ltd]:Sichuan Lingyun Technology Co., LTD # 组织 Organizational Unit Name (eg, section) []: # 部门 Common Name (e.g. server FQDN or YOUR name) []:Sichuan Lingyun Technology Co., LTD # 公司 Email Address []: # 邮箱
完成上述步骤后,创建 ssl 证书私钥:
1 2 3 4 5
$ openssl genrsa -out server.key 2048 Generating RSA private key, 2048 bit long modulus ...................................................................................+++ ..........+++ e is 65537 (0x010001)
$ openssl req -new -key server.key -out server.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) [AU]:CN State or Province Name (full name) [Some-State]:SiChuan Locality Name (eg, city) []:ChengDu Organization Name (eg, company) [Internet Widgits Pty Ltd]:Sichuan Lingyun Technology Co., LTD Organizational Unit Name (eg, section) []: Common Name (e.g. server FQDN or YOUR name) []:Sichuan Lingyun Technology Co., LTD Email Address []:
Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []: An optional company name []: