On Windows, for .NET Framework classes we can specify sslkeyrepository
as *SYSTEM/*USER.On linux
where does the .NET Core classes search for the certificates
by default and what could be the values for sslkeyrepository
.
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
For Linux and Mac
.NET CORE
will useOpenSSL
.command to generate a private key and a certificate signing request:
command to create a self-signed certificate:
command to generate a pfx file containing the certificate and the private key that you can use with Kestrel:
After that
Trust the certificate
This step is optional, but without it the browser will warn you about your site being potentially unsafe. You will see something like the following if you browser doesn’t
trust your certificate
:There is no centralized way of trusting the a certificate on Linux so you can do one of the following:
Exclude the URL you are using in your browsers exclude list
Trust all self-signed certificates on localhost
Add the https.crt to the list of trusted certificates in your browser.
How exactly to achieve this depends on your browser/distro.
You can also reference the complete Kestrel HTTPS sample app
or Follow this Blog Configuring HTTPS in ASP.NET Core across different platforms
.Net Core
uses OpenSSL on Linux, as a result, you need to set up your linux environment in the container so that OpenSSL will pick up the certificate.You can do this by two ways:
Copying the the certificate
.crt
file to a location thatupdate-ca-certificates
will scan for trusted certificates - e.g./usr/local/share/ca-certificates/
oron RHEL/etc/pki/ca-trust/source/anchors/
:Invoking
update-ca-certificates
: