简体   繁体   English

cURL 与 NSS - 找不到证书

[英]cURL with NSS - Can't find certificate

I'm trying to cURL using a certificate stored in an NSS database, however while running the cURL command, it says the certificate cannot be found.我正在尝试使用存储在 NSS 数据库中的证书进行 cURL,但是在运行 cURL 命令时,它说找不到证书。 Here is the list of the certs in my DB:这是我的数据库中的证书列表:

[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                                                  ,,   

You can see the "Test User" cert is in there.您可以看到“测试用户”证书在那里。 I also confirmed that SSL_DIR is set to the DB directory:我还确认 SSL_DIR 设置为 DB 目录:

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

However, when I run the cURL command:但是,当我运行 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

Any reason why it can't find the cert?找不到证书的任何原因?

I figured out the issue.我想通了这个问题。 It was a couple of issues.这是几个问题。

When creating the database, I should have added the --empty-password flag:创建数据库时,我应该添加 --empty-password 标志:

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

Also, when adding the cert, I needed to add sql: before the NSS DB field:另外,在添加证书时,我需要在 NSS DB 字段之前添加 sql: :

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM