I created self signed SSL certificates by following this tutorial: https://devblogs.microsoft.com/aspnet/configuring-https-in-asp-net-core-across-different-platforms/
I am using Linux Ubuntu 16.04 LTS
It is ASP.NET 5
application and I am running it in docker
.
So this are steps. I created file https.config
[ req ]
default_bits = 2048
default_md = sha256
default_keyfile = key.pem
prompt = no
encrypt_key = no
distinguished_name = req_distinguished_name
req_extensions = v3_req
x509_extensions = v3_req
[ req_distinguished_name ]
commonName = "localhost"
[ v3_req ]
subjectAltName = DNS:localhost
basicConstraints = critical, CA:false
keyUsage = critical, keyEncipherment
extendedKeyUsage = critical, 1.3.6.1.5.5.7.3.1
Then generated private key:
openssl req -config https.config -new -out csr.pem
Then created certificate
openssl x509 -req -days 365 -extfile https.config -extensions v3_req -in csr.pem -signkey key.pem -out https.crt
And finally generated pfx file:
openssl pkcs12 -export -out https.pfx -inkey key.pem -in https.crt -password pass:mypassword
I pass location and password to give Kestrel info about certificates and it fails on password check altought password is ok. I think it loads the certificate because when I put another path of the file I get another error.
sudo docker run -p 50205:443 -e "ASPNETCORE_URLS=http://+:80;https://+:443" -e "ASPNETCORE_Kestrel__Certificates__Default__Path=/https/https.pfx" -e "ASPNETCORE_Kestrel__Certificates__Default__Password=mypassword" -v /home/vlado/Desktop/https.pfx:/https/https.pfx 622