linux服务器上生成CSR和KEY


CSR表示“ 证书签名请求 ”,这个该证书将用于服务器上。一个CSR包含有关您的组织和域名,地方和国家,将包含在证书中的公钥信息。 本文有3个简单的步骤来建立CSR上的Linux系统(证书签名请求)。您能够选择如下之一。node

 

CSR文件用来申请证书(提供给证书供应商)git

KEY文件是私钥,用来配置ssl(放到服务器)web

CERT是证书供应商颁发的证书(放到服务器)服务器

 

1.先建立个文件夹,而后进入这个文件夹执行命令:app

  mkdir  ssldom

  cd sslspa

2.执行命令:code

  openssl req -nodes -newkey rsa:2048 -keyout myserver.key -out server.csrserver

    执行完会出现一些要输入的信息:
blog

  

Country Name (2 letter code) [AU]: CN  (国家代码)
State or Province Name (full name) [Some-State]: BJ  (省)
Locality Name (eg, city) []: BJ   (城市)
Organization Name (eg, company) [Internet Widgits Pty Ltd]: iHost (企业/组织)
Organizational Unit Name (eg, section) []: IT  (部门)
Common Name (eg, YOUR name) []: ibaohost.com   (域名/请正确填写)
Email Address []:  (可直接回车)
Please enter the following 'extra' attributes to be sent with your certificate request
 
A challenge password []:   (直接回车)
An optional company name []:  (直接回车)
Use the name of the web-server as Common Name (CN). If the domain name (Common Name) is mydomain.com append the domain to the hostname (use the fully qualified domain name).
 
其中的Email Address  和 A challenge password 能够留空,没必要填写,直接回车。以上须要填写的内容,若是你不清楚应该怎么填写,除了域名,其余的你能够按照上面的内容填写。

3.执行完 命令后  ,输入命令: ls

  能够看到生成的key和csr文件

  

 

 

  执行这些须要在服务器上装了ssl。

下面还有一种方法:简便的三条命令:

yum install openssl   安装
openssl genrsa -out howtoing.com.key 2048   生成key文件  2048位
openssl req -new -key howtoing.com.key -out howtoing.com.csr   

howtoing.com能够改为本身的文件名。
相关文章
相关标签/搜索