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中使用

浏览器查看证书:

相关推荐
pengyi8710156 小时前
独享IP池自动化维护方案,智能检测自动延长使用寿命
网络协议·tcp/ip·自动化
德思特9 小时前
通过 Wireshark 抓取串口命令
网络协议·测试工具·wireshark
KnowSafe11 小时前
2026年SSL证书市场便宜且安全的SSL证书调研
网络协议·安全·ssl
dangdanding14 小时前
防火墙 IP 分片测试套件-fragroute
linux·网络·网络协议·tcp/ip
TechWayfarer14 小时前
AI大模型时代:IP数据云如何适配智能体场景需求
开发语言·人工智能·python·网络协议·tcp/ip·langchain
冰冰的米咖16 小时前
交换与路由技术整理与总结(持续更新版)
网络·网络协议·智能路由器
Ether IC Verifier16 小时前
TCP/IP协议握手原理详解——结合以太网连接过程
服务器·网络·数据库·网络协议·tcp/ip
山栀shanzhi17 小时前
TCP 和 UDP 区别
网络协议·tcp/ip·udp
HMS工业网络18 小时前
使用电脑快速测试PROFIBUS 设备通讯
网络·网络协议·profibus·主站·设备通讯
handler0118 小时前
【Linux 网络】一文读懂 HTTP 协议
linux·c语言·网络·c++·笔记·网络协议·http