我使用以下命令生成根 CA:
openssl genrsa -aes256 -out ca.key.pem -passout pass:KeyPassword 4096
openssl req -key ca.key.pem -passin pass:Password -new -x509 -days 365 -sha256 -out ca.root.pem
然后我使用以下命令创建签名的用户证书(不使用中间证书):
1)为用户生成密钥
openssl req -newkey rsa:2048 -nodes -keyout keyname.pem -days 365
2) 创建企业社会责任
openssl req -out keyname.csr -key keyname.pem -new -days 365
3)使用根证书签署密钥
openssl ca -batch -create_serial -config openssl.cnf -cert ca.root.pem -keyfile ca.key.pem -passin pass:KeyFinalPassword -in keyname.csr -out certname.pem
4) 生成.p12文件
openssl pkcs12 -name username -inkey keyname.pem -in certname.pem -export -out username.p12 -password pass:password
注意 - 我已将 crlDistributionPoints = URI:http://localhost:8000/crl/distripoint.crl.pem 添加到 openssl.cnf 以及以下选项:
# For certificate revocation lists.
# crlDistributionPoints = URI:http://HOSTNAME/crl/distripoint.crl.pem
crlDistributionPoints = URI:http://localhost:8000/crl/distripoint.crl.pem
crlnumber = $dir/config/crl/crlnumber
crl = $dir/config/crl/ca.crl.pem
crl_extensions = crl_ext
default_crl_days = 60
注意-我使用 本教程
生成了 distribution.crl.pem必须将
crlDistributionPoints
参数添加到您正在使用的 CA 的 x509_extensions
部分。 (在您的示例中,您似乎已将此参数添加到 CA 部分本身。)
openssl ca
使用 openssl.cnf
和这些行将 CRL Distribution Points
扩展添加到颁发的证书中:
[ ca ]
default_ca = CA_default
[ CA_default ]
(...other parameters...)
x509_extensions = added-extensions
[ added-extensions ]
crlDistributionPoints = URI:http://localhost:8000/crl/distripoint.crl.pem
您可能想要使用自定义的
openssl.cnf
而不是 req
和 ca
命令的默认值;默认包含许多示例条目,这些条目可能无法满足您的要求。以下是 最小 openssl.cnf
的示例。
(旁注:生成 .p12 文件的最后一个命令与问题无关;它仅以其他格式打包已创建的证书。)
对于 easyrsa v3+,CRL 以及 CA 证书分发 URL 可以包含在每个签名证书中,方法是将信息包含在
中/usr/share/easy-rsa/3/x509-types/COMMON
文件的默认内容是;
# X509 extensions added to every signed cert
# This file is included for every cert signed, and by default does nothing.
# It could be used to add values every cert should have, such as a CDP as
# demonstrated in the following example:
#crlDistributionPoints = URI:http://example.net/pki/my_ca.crl
# The authority information access extension gives details about how to access
# certain information relating to the CA.
#authorityInfoAccess = caIssuers;URI:http://example.net/pki/my_ca.crt
从第 7 行和/或第 12 行删除前导 # 后,将 URI 更改为您的特定要求。