无法设置私钥文件:"./cert.pem"类型PEM [英] unable to set private key file: './cert.pem' type PEM

查看:116
本文介绍了无法设置私钥文件:"./cert.pem"类型PEM的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用curl来使用公共证书文件从https站点下载数据.

I am using curl to download data from a https site using public certificate files.

系统信息:

  • 操作系统: fedora 14
  • 卷曲: curl 7.30.0
  • openssl: OpenSSL 1.0.0a-fips
  • OS: fedora 14
  • curl: curl 7.30.0
  • openssl: OpenSSL 1.0.0a-fips

命令是

curl -v "https://<ip:<port>" --cert "./cert.pem" --cacert "./cacert.pem" --cert-type PEM
* About to connect() to kng.com port 443 (#0)
*   Trying 11.19.37.123...
* Adding handle: conn: 0x8189e68
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x8189e68) send_pipe: 1, recv_pipe: 0
* Connected to fkng.com (11.19.37.123) port 443 (#0)
* unable to set private key file: './cert.pem' type PEM
* Closing connection 0
curl: (58) unable to set private key file: './cert.pem' type PEM

我已授予.pem文件的所有权限,但是curl仍会引发错误.

I have have given all the permission to the .pem file, still curl is throwing an error.

推荐答案

阅读选项上的cURL 文档您所使用的证书的私钥似乎不在同一文件中.如果它在其他文件中,则需要使用--key文件并提供密码来提及它.

After reading cURL documentation on the options you used, it looks like the private key of certificate is not in the same file. If it is in different file, you need to mention it using --key file and supply passphrase.

因此,请确保cert.pem具有私钥(以及证书)或使用--key选项提供.

So, please make sure that either cert.pem has private key (along with the certificate) or supply it using --key option.

此外,本文档还提到 请注意,此选项假定有一个证书"文件,该文件是私有密钥和私有证书的连接!

Also, this documentation mentions that Note that this option assumes a "certificate" file that is the private key and the private certificate concatenated!

它们如何连接?这很容易.将它们一个接一个地放在同一文件中.

How they are concatenated? It is quite easy. Put them one after another in the same file.

您可以在此处获得更多帮助.

You can get more help on this here.

我相信这可能会对您有所帮助.

I believe this might help you.

这篇关于无法设置私钥文件:"./cert.pem"类型PEM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆