内容目录
地址:
https://devblogs.microsoft.com/dotnet/configuring-https-in-asp-net-core-across-different-platforms/
创建一个 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
将 commonName
、subjectAltName
中的 localhost
改一下。
openssl req -config https.config -new -out csr.pem
openssl x509 -req -days 365 -extfile https.config -extensions v3_req -in csr.pem -signkey key.pem -out https.crt
最后生成带密码的 pfx
openssl pkcs12 -export -out https.pfx -inkey key.pem -in https.crt -password pass:{你的密码}
文章评论
更多命令:https://learn.microsoft.com/en-us/azure/iot-hub/tutorial-x509-self-sign