curl: (58) Unable to load client key -8178

前端 未结 2 507
情话喂你
情话喂你 2021-02-01 16:53

I am facing an SSL issue with the curlcommand. I want to reach an URL using my SSL client certificate and private key.

This is my command:

$         


        
2条回答
  •  礼貌的吻别
    2021-02-01 17:32

    I've gone through the same problem, and found a solution finally, maybe it can help you.

    The failure was due to the private key in PKCS#8 format:

    • a PKCS#8 private key starts with -----BEGIN ENCRYPTED PRIVATE KEY----- header
      or
      -----BEGIN PRIVATE KEY----- header

      With this key curl + openssl will works, but curl + nss + libnsspem.so wouldn't.

    • with a RSA private key which starts with
      -----BEGIN RSA PRIVATE KEY----- header

      both curl + openssl and curl + nss + libnsspem.so will work.

    So use this command

    openssl pkcs8 -in path/to/your/pkcs8/key -out path/to/rsa/key
    

    to convert the PKCS#8 key to traditional RSA key.

提交回复
热议问题