Skip to content

Instantly share code, notes, and snippets.

@SaahilClaypool
Last active November 9, 2020 16:59
Show Gist options
  • Save SaahilClaypool/e6ff92402670655396b03f85956352ae to your computer and use it in GitHub Desktop.
Save SaahilClaypool/e6ff92402670655396b03f85956352ae to your computer and use it in GitHub Desktop.
Dotnet core self signed certificate on linux

install certificates for asp.net core

openssl genrsa -des3 -out rootCA.key 2048
openssl req -x509 -new -nodes -key rootCA.key -sha256 -days 1024 -out rootCA.pem  -addext "subjectAltName = DNS:localhost"
openssl pkcs12 -export -out certificate.pfx -inkey rootCA.key -in rootCA.pem 
openssl pkcs12 -in certificate.pfx -clcerts -out pfx.pem
sudo cp pfx.pem /usr/local/share/ca-certificates/pfx.crt
sudo cp pfx.pem /usr/share/ca-certificates/pfx.crt
sudo bash -c "echo "pfx.crt" >> /etc/ca-certificates.conf"
sudo update-ca-certificates
export ASPNETCORE_Kestrel__Certificates__Default__Path="$HOME/Software/SSL/certificate.pfx"
export ASPNETCORE_Kestrel__Certificates__Default__Password="Testing123!@#"
dotnet run
curl -vv 1.0 https://localhost:5001

# in chrome, go to the site, export certificate, then import
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment