这里笔者主要讲述如何生成一个CSR证书签名请求文件,方法过程可能有多种
笔者这里将使用一种最为简单简洁的方式进行讲解,使用到的环境与软件如下:
操作系统:Red Hat Enterprise Linux release 8.7 (Ootpa)
openssl软件包版本:openssl-1.1.1k-9.el8_7.x86_64
1、创建私钥的同时,也就同时生成CSR文件的过程如下,其他命令就一条都是可以的
openssl req -new -newkey rsa:2048 -nodes -out xxx.csr -keyout xxx.key
[root@qq-5201351 ~]# openssl req -new -newkey rsa:2048 -nodes -out www.qq-5201351.com.csr -keyout www.qq-5201351.com.key Generating a RSA private key .............+++++ .....................................................................................................+++++ writing new private key to 'www.qq-5201351.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]:CN State or Province Name (full name) []:Sichuan Locality Name (eg, city) [Default City]:Chengdu Organization Name (eg, company) [Default Company Ltd]:xxxx company Organizational Unit Name (eg, section) []:IT OPERATIONS Common Name (eg, your name or your server's hostname) []:www.qq-5201351.com Email Address []:5201351@qq.com Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []: An optional company name []: [root@qq-5201351 ~]#
其中命令的几个选项说明如下:
-
-nodes:指定密钥文件不被加密。
-
-newkey rsa:2048:指定密钥类型和长度。
++++++++++++++++++++++++++++++++++++++++++++++++++++
其中我们在准备生成CSR文件的时候,最主要的就是需要准备好如下7个核心的信息
Country Name (2 letter code):申请单位所属国家,只能是两个字母的国家码。例如,中国只能是CN。
State or Province Name (full name) []:州名或省份名称,可以是中文或英文。
Locality Name (eg, city):城市名称,可以是中文或英文。
Organization Name (eg, company) [Default Company Ltd]:公司名称,可以是中文或英文。
Organizational Unit Name (eg, section) []:部门名称,可以是中文或英文。
Common Name (eg, your name or your server's hostname) []:申请SSL证书的具体网站域名。
Email Address:邮箱地址
A challenge password:可选择不输入。