与NSS的cURL – 找不到证书

我正在尝试使用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

有什么理由无法找到证书?

最佳答案 我想出了这个问题.这是几个问题.

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

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

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

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