Dotnet Self-Signed Certificate

PUBLISHED ON JAN 12, 2024 — DOTNET, HOW-TO, LINUX

When building a dotnet project and you need to make HTTPS for your project your quickest option is to generate a self-signed certificate, for that, you can run the following commands:

openssl req -new -x509 -newkey rsa:2048 -keyout localhost.key -out localhost.cer -days 365 -subj /CN=localhost
openssl pkcs12 -export -out localhost.pfx -inkey localhost.key -in localhost.cer

Please keep in mind that you will be prompted for a password.

That’s it, you probably need to configure the application to use HTTPS and look for the PFX file.

comments powered by Disqus