# Dotnet Self-Signed Certificate

> Create a self-signed certificate for your dotnet project

- Canonical URL: <https://carlossura.com/blog/dotnet-self-signed-certificate/>
- Author: Carlos Sura
- Published: 2024-01-12
- Tags: dotnet, linux, ssl, certificate, microsoft

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.
