与NSS的cURL - 找不到证书

时间:2015-11-18 15:48:06

标签: curl certificate nss

我正在尝试使用NSS数据库中的证书存储来进行cURL,但是在运行cURL命令时,它说无法找到证书。以下是我的数据库中的证书列表:

[root@localhost scripts]# certutil -L -d /nss

Certificate Nickname                                         Trust Attributes
                                                             SSL,S/MIME,JAR/XPI

Test User                                                     u,u,u
Test Root CA                                                 ,,   
Test SUBCA2                                                  ,,   

您可以看到“测试用户”证书。我还确认SSL_DIR设置为DB目录:

[root@localhost scripts]# echo $SSL_DIR
/nss

但是,当我运行cURL命令时:

[root@localhost etc]# curl -vk --cert "Test User" https://localhost:7446
* About to connect() to localhost port 7446 (#0)
*   Trying ::1... connected
* Connected to localhost (::1) port 7446 (#0)
* Initializing NSS with certpath: sql:/nss
* warning: ignoring value of ssl.verifyhost
* skipping SSL peer certificate verification
* NSS: client certificate not found: Test User
* NSS error -5938
* Closing connection #0
curl: (35) NSS: client certificate not found: Test User

无法找到证书的任何理由?

1 个答案:

答案 0 :(得分:3)

我想出了这个问题。这是几个问题。

创建数据库时,我应该添加--empty-password标志:

certutil -N -d /nss --empty-password

此外,在添加证书时,我需要在NSS DB字段之前添加sql:

pk12util -i cert.p12 -d sql:/nss