'The certificate chain issued by an untrusted authority

I am using the curl terminal and while issuing the following command :-

curl --anyauth --user admin:admin "https://localhost:8000/LATEST/search?q=caesar"

I am getting below alert :-

curl: (77) schannel: next InitializeSecurityContext failed: SEC_E_UNTRUSTED_ROOT (0x80090325) - The certificate chain was issued by an authority that is not trusted.

Please suggest. I have installed curl in Windows and also downloaded the .pem file and placed it in the same folder.



Solution 1:[1]

If your server has a self-signed cert, then by default curl doesn't know that it can trust that the server is who it says it is, and doesn't want to talk.

You can either:

  • import the cert into your trust store (best and most secure)
  • apply the -k or --insecure switch to ignore and continue. This may be fine for local development.
  • use a real cert, signed by a trusted CA

Solution 2:[2]

For local dev and a quick solution, run this line
set_config( config( ssl_verifypeer = 0L ) )
before
httr::GET(....)

but as suggested it's still preferable to use a real cert.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mads Hansen
Solution 2 Zeus