加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

与NSS的cURL – 找不到证书

发布时间:2020-12-13 23:27:40 所属栏目:Linux 来源:网络整理
导读:我正在尝试使用NSS数据库中的证书存储来进行cURL,但是在运行cURL命令时,它表示无法找到证书.以下是我的数据库中的证书列表: [root@localhost scripts]# certutil -L -d /nssCertificate Nickname Trust Attributes SSL,S/MIME,JAR/XPITest User u,u,uTest R
我正在尝试使用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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读