Search code examples
ssl.net-corenuget

How to use non default ca certs for dotnet core and nuget?


My company use its own ssl certificates when communicating to internet, the command line e.g. dotnet add package will failed to run:

error: Unable to load the service index for source 
https://api.nuget.org/v3/index.json.
error:   The SSL connection could not be established, see inner exception.
error:   Authentication failed, see inner exception.
error:   The client and server cannot communicate, because they do not possess a common algorithm

Is there anyway to let dotnet tool and libraries use an alternate cert?


Solution

  • As far as I understand, there is an intermediary in your company which encapsulates all connections with company SSL, thus Nuget cannot trust your SSL certificate (It thinks that there is a man in the middle which causes security hole).

    you may want to check Issue #4387 and Issue 5773

    You may consider to fork Nuget Repository to disable SSL Enforcement.

    Also, AFAIK SSL_CERT_DIR and SSL_CERT_FILE environment variables are supported starting from .Net Core 2.1 [3]