iOS网络https证书格式问题
一、使用钥匙串:
-
1.双击证书(由后台提供)进行安装(格式任意:.key、.pem、.pfx、.crt等);
-
2.(通过证书里的常用名称)找到刚刚安装的证书,导出 .cer 格式文件;
-
3.将 .cer 文件导入工程,即可配置使用。
二、使用命令行:
-
Step1. 将 .pem 转换为 .crt格式:
-
方法(1):
openssl x509 -outform der -in your-cert.pem -out your-cert.crt
-
方法(2):
// 把 .pem 转成 .PKCS12 格式 openssl x509 -outform der -in your-cert.pem -out your-cert.crt // 然后把 .PKCS12 转换成 .crt 格式 openssl pkcs12 -in cacert.p12 -out mycerts.crt -nokeys -clcerts
-
-
Step2. 将 .crt 转换为 .cer 格式:
openssl x509 -inform pem -in your-cert.crt -outform der -out your-cert.cer