dotnet dev-certs https --trust --export-path aa.pem --no-password --format PEM
如下 导出pem格式 公钥和私钥一起生成。
C:\Users\Administrator>dotnet dev-certs https --trust --export-path aa.pem --no-password --format PEM
Trusting the HTTPS development certificate was requested. A confirmation prompt will be displayed if the certificate was not previously trusted. Click yes on the prompt to trust the certificate.
Successfully trusted the existing HTTPS certificate.
C:\Users\Administrator>dotnet dev-certs https --trust --export-path aa.pem --no-password --format PEM
C:\Users\Administrator>dir|findstr aa
2024/05/23 15:34 1,703 aa.key
2024/05/23 15:34 1,118 aa.pem
C:\Users\Administrator>
官方文档中 ,pem为私钥部分
![](https://img.haomeiwen.com/i2815884/3f8a5d02a508a56b.png)
更多命令如下
dotnet dev-certs https
[-c|--check] [--clean] [-ep|--export-path <PATH>]
[--format] [-i|--import] [-np|--no-password]
[-p|--password] [-q|--quiet] [-t|--trust]
[-v|--verbose] [--version]
dotnet dev-certs https -h|--help
生成crt
dotnet dev-certs https -ep ./certificate.crt -p $CREDENTIAL_PLACEHOLDER$ --trust --format PEM
更多参考文档
https://learn.microsoft.com/zh-cn/dotnet/core/tools/dotnet-dev-certs
在 ASP.NET Core 中强制使用 HTTPS | Microsoft Learn
https://learn.microsoft.com/zh-cn/aspnet/core/security/authentication/certauth?view=aspnetcore-8.0
网友评论