Issue: .NET HTTPS Development Certificate Not Trusted on Ubuntu 24.04 (Edge & Chrome)
During the configuration of .NET HTTPS development certificate on Ubuntu 24.04 for Microsoft Edge and Google Chrome, you may encounter an issue where the certificate is not trusted by the browsers. This article will provide a detailed context and solution for this problem.
Understanding .NET HTTPS Development Certificate
A development certificate is used to secure communication between a client and a server during the development process. When working with .NET applications that use HTTPS, a development certificate is necessary for testing and debugging purposes.
Why is the Certificate Not Trusted?
By default, Ubuntu does not trust the .NET development certificate. This is because the certificate is not issued by a trusted Certificate Authority (CA). As a result, both Microsoft Edge and Google Chrome will not trust the certificate and display a warning message.
Solution: Trusting the .NET Development Certificate on Ubuntu 24.04
To trust the .NET development certificate on Ubuntu 24.04, you need to follow these steps:
-
Export the .NET development certificate.
-
Convert the certificate to the PEM format.
-
Add the certificate to the Ubuntu certificate store.
Step 1: Exporting the .NET Development Certificate
To export the .NET development certificate, open a command prompt and run the following command:
dotnet dev-certs https --export-cert .pfx
Step 2: Converting the Certificate to the PEM Format
To convert the certificate to the PEM format, run the following command:
openssl pkcs12 -in .pfx -out .pem -nodes
Step 3: Adding the Certificate to the Ubuntu Certificate Store
To add the certificate to the Ubuntu certificate store, run the following command:
sudo security add-trusted-cert -d .pem
Testing the Certificate
After completing the above steps, restart your browser and navigate to your .NET application that uses HTTPS. The warning message should no longer be displayed. If you are still experiencing the issue, make sure to check the path to the certificate and run the commands again.
- By default, Ubuntu does not trust the .NET development certificate. This issue can be resolved by exporting the certificate, converting it to the PEM format, and adding it to the Ubuntu certificate store.
- Here are the steps you need to follow:
- Export the .NET development certificate using
dotnet dev-certs https --export-cert. - Convert the certificate to the PEM format using
openssl pkcs12 -in -out -nodes. - Add the certificate to the Ubuntu certificate store using
security add-trusted-cert -d.
References
-
Type: Article
Title: .NET Core Certificate not trusted in Chrome and Edge when developing on Linux
URL:
-
Type: Article
Title: How to add a self-signed certificate to Ubuntu 20.04
URL: