我正在像这样创建我的证书:
openssl genrsa -out rootCA.key 2048
openssl req -x509 -new -key rootCA.key -sha512 -days 36501 -out rootCA.pem \
-extensions v3_req
openssl genrsa -out client1.key 2048
openssl req -new -key client1.key -sha512 -days 36500 -out client1.csr \
-extensions v3_req
openssl x509 -req -days 36500 -CA rootCA.pem -CAkey rootCA.key \
-CAcreateserial -CAserial serial -in client1.csr -out client1.pem
openssl verify -verbose -CAfile rootCA.pem client1.pem
openssl pkcs12 -export -in client1.pem -inkey client1.key -out client1.p12 -name "client1"
Run Code Online (Sandbox Code Playgroud)
我希望 .p12 证书使用 sha512 算法。我想过将选项 -sha512 添加到转换(最后一行),但似乎 pkcs12 没有这个选项。有任何想法吗?
PKCS#12 支持以下用于私钥加密的加密算法。
默认情况下使用 3 键三重 DES,因此如果您愿意,无需提供 -des3。
您可以使用以下命令从生成的 pkcs12 文件中输出一些信息:
openssl pkcs12 -in client1.p12 -noout -info
Run Code Online (Sandbox Code Playgroud)
附带说明一下,当您生成 x509 客户端证书时,如果您想使用 sha-512 散列函数,则需要提供 -sha512 参数。
验证是否实际使用了 sha512 哈希函数:
openssl x509 -in client1.pem -noout -text
Run Code Online (Sandbox Code Playgroud)
如果没有,则使用 -sha512 重新创建它
openssl x509 -sha512 -req -days 36500 -CA rootCA.pem -CAkey rootCA.key \
-CAcreateserial -CAserial serial -in client1.csr -out client1.pem
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6839 次 |
| 最近记录: |