Create and Trust a Self-Signed SSL certificate using dotnet dev-certs
Easy 5-step CLI commands to create a localhost cert
Generate a self-signed SSL cert in Windows using dotnet dev-certs CLI command
1. Install .NET SDKwinget install Microsoft.DotNet.SDK.10
2. Create the pfx file using dev-certs
dotnet dev-certs https -ep $env:USERPROFILE\.aspnet\https\aspnetapp.pfx -p MyPassword
3. Trust the cert
dotnet dev-certs https --trust
4. Convert the pfx file to jks
keytool -importkeystore -srckeystore $env:USERPROFILE\.aspnet\https\aspnetapp.pfx -srcstoretype PKCS12 -srcstorepass MyPassword -destkeystore tls.jks -deststoretype JKS -deststorepass MyPassword -destkeypass MyPassword
5. Clean up/uninstall
dotnet dev-certs https --clean