| 生成 CSR | openssl req -new -key key.pem -out req.csr -addext "subjectAltName=DNS:example.com" |
|---|---|
| 生成自签 | openssl req -x509 -newkey rsa:2048 -nodes -days 365 |
| 查看校验 | openssl req -in req.csr -noout -text -verify |
| 配置复用 | -config 指定 openssl.cnf 的默认字段与扩展模板 |
生成并检查 CSR
生成并检查 CSR
openssl req -new -key example.com.key -out example.com.csr -subj "/C=CN/O=Example/CN=example.com" -addext "subjectAltName=DNS:example.com,DNS:www.example.com"
openssl req -in example.com.csr -noout -text | grep -A2 'Alternative'-subj 适合脚本化生成;手工流程可用 -config 提供默认值,减少字段遗漏。