netcore https配置

一、生成证书

复制代码
1. 安装 OpenSSL
如果尚未安装 OpenSSL,可以通过以下命令安装:

Ubuntu/Debian:

sudo apt update
sudo apt install openssl
CentOS/RHEL:


sudo yum install openssl
2. 生成私钥
使用以下命令生成私钥文件(private.key):

openssl genpkey -algorithm RSA -out private.key
3. 生成证书签名请求(CSR)
使用以下命令生成 CSR 文件(certificate.csr):

openssl req -new -key private.key -out certificate.csr
在生成 CSR 时,会提示你输入一些信息,如国家代码、组织名称、域名等。

4. 生成自签名证书
使用以下命令生成自签名证书(certificate.crt):

openssl x509 -req -days 365 -in certificate.csr -signkey private.key -out certificate.crt
5. 打包为 .pfx 文件
使用以下命令将私钥和证书打包为 .pfx 文件:

openssl pkcs12 -export -out certificate.pfx -inkey private.key -in certificate.crt
系统会提示你设置 .pfx 文件的密码,请记住这个密码,后续在 .NET Core 中配置 HTTPS 时需要用到。

netcore中使用

浏览器查看证书:

相关推荐
wanzhong233319 小时前
开发日记2-创建http文件测试http接口
网络·网络协议·http
sweet丶1 天前
DNS安全威胁:从劫持、污染到放大攻击的演练
网络协议·安全
小南知更鸟1 天前
前端静态项目快速启动:python -m http.server 4173 与 npx serve . 全解析
前端·python·http
科技块儿1 天前
电商风控实战:如何利用访客IP防控有效识别刷d行为?
大数据·网络协议·tcp/ip
Andy工程师2 天前
网络响应码(HTTP 状态码)和解析方法
网络·网络协议·http
浅陌sss2 天前
使用Unity从IIS搭建的文件服务器下载资源时出现HTTP/1.1 404 Not Found
运维·服务器·http
2501_916007472 天前
iPhone APP 性能测试怎么做,除了Instruments还有什么工具?
android·ios·小程序·https·uni-app·iphone·webview
2501_915106322 天前
Windows 环境下有哪些可用的 iOS 上架工具, iOS 上架工具的使用方式
android·ios·小程序·https·uni-app·iphone·webview
Andy工程师2 天前
Netty 与 Spring Boot + HTTP 客户端(如 RestTemplate、WebClient)应用场景区别
spring boot·后端·http
终端行者2 天前
Nginx端到端反向代理https配置
运维·nginx·https