iOS C#远程推送证书.p12文件制作

Posted on 2020-08-11 10:39  向往远方  阅读(396)  评论(0编辑  收藏  举报

1、PushChat.certSigningRequest      请求证书文件

  生成Certificate Signing Request (CSR):

 

技术分享

 

2、填写你的邮箱和Common Name,这里填写为PushChat。选择保存到硬盘。

 

技术分享

 


  这样就在本地生成了一个PushChat.certSigningRequest文件

2、aps.p12                       请求证书文件后, 在证书秘钥中生成了一个公钥和私钥, 通过私钥导出的p12文件

  导出密钥,并输入你的密码。

 

技术分享

 

输入你的密码:

 

技术分享

 


  这样就生成了一个aps.p12文件

3、aps_distribution_identity.p12         使用请求证书文件 生成的  推送证书

 

具体配置操作:

使用OpenSSL

1、将aps.cer转换成aps_identity.pem格式。

 openssl x509 -in aps.cer -inform der -out aps_identity.pem

2、将p12格式的私钥转换成pem,需要设置4次密码,密码都设置为:abc123。

 openssl pkcs12 -nocerts -out aps_noenc.pem -in aps.p12 

3、用certificate和the key 创建PKCS#12格式的文件。

 openssl pkcs12 -export -in aps_identity.pem -inkey aps_noenc.pem -certfile CertificateSigningRequest.certSigningRequest -name "aps_distribution_identity" -out aps_distribution_identity.p12

这样我们就得到了在.net应用程序中使用的证书文件:aps_distribution_identity.p12。

注意:如果报错”unable to load certificates”,把第三条命令的-certfile CertificateSigningRequest.certSigningRequest 去掉就好

 

参考:http://www.mamicode.com/info-detail-1272927.html;https://www.jianshu.com/p/6c188e158f2d;https://www.cnblogs.com/jiackyan/p/4140648.html

Copyright © 2024 向往远方
Powered by .NET 8.0 on Kubernetes