我在使用curl
命令时遇到了SSL问题,我想要使用我的SSL客户端证书和私钥访问一个URL。
这是我的命令:
$ curl -k -v "https://myurl.com/" --cert ./certificate.pem --key ./private.key
* About to connect() to xx.xx.xx.xx port 23444 (#0)
* Trying xx.xx.xx.xx... connected
* Connected to xx.xx.xx.xx (xx.xx.xx.xx) port 23444 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* warning: ignoring value of ssl.verifyhost
* Unable to load client key -8178.
* NSS error -8178
* Closing connection #0
curl: (58) Unable to load client key -8178.
这个密钥受到密码保护,但curl
没有要求我输入密码,这很奇怪。即使我使用--pass
传递密码,我仍然会收到相同的错误信息。
似乎参数--key
没有被考虑在内,因为如果我将其替换为foo.key
(该文件在我的文件系统中不存在),我仍然会收到相同的错误信息。
然而,如果我使用:
$ wget --certificate=./certificate.pem --private-key=private.key "https://myurl.com/" --no-check-certificate
我能够访问我的URL。
你有任何想法吗?