使用 OpenSSL 生成的 SSL 证书不适用于 NSS [英] SSL certificate generated with OpenSSL not working on NSS
问题描述
我在 Linux Mint 机器上使用 OpenSSL 生成了 SSL 证书(key.pem、cacert.pem、pcert.pem).现在我正在尝试将我的应用程序移动到另一台安装了 Fedora 18 和 NSS 的服务器.
I have SSL certificate ( key.pem, cacert.pem, pcert.pem ) generated with OpenSSL on Linux Mint machine. Now I'm trying to move my application to another server where is installed Fedora 18 with NSS.
cURL 返回此错误:
cURL is returning this error:
unable to load client key: -8178 (SEC_ERROR_BAD_KEY)
我再次测试,在我的电脑上工作正常,但在服务器上没有.我认为是因为我使用 OpenSSL 生成证书,但在服务器上安装了 NSS.
I tested again and on my computer is working fine but on server not. I think it's because I used OpenSSL to generate certificates but on server is installed NSS.
我找不到如何使用certutil"或openssl"生成对 NSS 有效的证书.
I can't find how to generate certificates with "certutil" or with "openssl" to be valid with NSS.
推荐答案
失败是由于我的 PKCS#8 私钥格式:
- 使用 PKCS#8 私钥-----BEGIN ENCRYPTED PRIVATE KEY-----
标头
或-----BEGIN PRIVATE KEY-----
标头
curl+openssl 有效,但 curl+nss+libnsspem.so
- 使用 RSA 私钥-----BEGIN RSA PRIVATE KEY-----
标头
curl+openssl 和 curl+nss+libnsspem.so 都可以工作.
The failure was due to my PKCS#8 private key format:
- With a PKCS#8 private key
-----BEGIN ENCRYPTED PRIVATE KEY-----
header
or
-----BEGIN PRIVATE KEY-----
header
curl+openssl works, but not curl+nss+libnsspem.so
- With a RSA private key
-----BEGIN RSA PRIVATE KEY-----
header
both curl+openssl and curl+nss+libnsspem.so work.
因此使用此命令 openssl rsa -in key.pem -out newkey.pem
删除 RSA 私钥上的密码:
So use this command openssl rsa -in key.pem -out newkey.pem
to remove the pass phrase on an RSA private key:
这篇关于使用 OpenSSL 生成的 SSL 证书不适用于 NSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!