1.生成私钥 openssl genrsa -out private.key 2048
2.生成证书请求 openssl req -new -key private.key -out cert.csr
3.创建自签名证书 openssl x509 -req -days 3650 -in cert.csr -signkey private.key -out cert.crt
4.将私钥和证书合并为PKCS12格式 openssl pkcs12 -export -in cert.crt -inkey private.key -out cert.p12
原文链接:https://blog.csdn.net/weixin_53069745/article/details/129999626