在 Linux 下使用 OpenSSL 生成 CSR(证书签名请求) 通常步骤如下:
openssl req -new -newkey rsa:2048 -nodes \
-keyout domain.key -out domain.csr
参数说明:
rsa:2048:生成 2048 位 RSA 私钥-nodes:不加密私钥(否则每次使用都要输密码)-keyout:私钥文件-out:CSR 文件执行后会提示输入信息:
Country Name (2 letter code): CN
State or Province Name: Beijing
Locality Name: Beijing
Organization Name: Your Company
Organizational Unit Name: IT
Common Name: www.example.com
Email Address:
openssl req -new -key domain.key -out domain.csr
openssl req -new -key domain.key -out domain.csr -config san.cnf
示例 san.cnf:
[req]
distinguished_name = req_distinguished_name
req_extensions = v3_req
[req_distinguished_name]
CN = www.example.com
[v3_req]
subjectAltName = @alt_names
[alt_names]
DNS.1 = www.example.com
DNS.2 = example.com
openssl req -in domain.csr -noout -text
openssl ecparam -genkey -name prime256v1 -noout -out domain.key
openssl req -new -key domain.key -out domain.csr
如果你是 Nginx / Apache / 泛域名 / 多域名证书,可以告诉我使用场景,我可以给你更精确的命令。