ios 将 .cer 转换为 .p12
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39091048/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Convert .cer to .p12
提问by Michael Schwartz
I'm working on a project for a client. I have two .cer files (developer and distribution) both are loaded into Keystore Access on Mac OS X. However I'm unable to export as a .p12 file.
我正在为客户做一个项目。我有两个 .cer 文件(开发者和发行版)都加载到 Mac OS X 上的 Keystore Access 中。但是我无法导出为 .p12 文件。
Alternatively I tried OpenSSL but still no luck...
或者我尝试了 OpenSSL 但仍然没有运气......
openssl pkcs12 -export -in followMe_ios_development.cer -out followMe_ios_development.p12 -clcerts -nokeys
openssl pkcs12 -export -in followMe_ios_development.cer -out followMe_ios_development.p12 -clcerts -nokeys
How can I export this .cer file as a .p12 so I can compile this app for iOS?
如何将此 .cer 文件导出为 .p12,以便为 iOS 编译此应用程序?
回答by buguibu
What works for me dealing with Push Notification certifies has been:
处理推送通知认证对我有用的是:
- Open the certificate:
open my_filename.cer
and click "View Certificates" to see the certificate's name - Go to Applications -> Utilities -> Keychain Access
- Ensure you have selected the "login" keychain, not the "system" one (thanks to @Matt Flettcher)
- Go to "Certificates"
- Look for the desired certificate
- Ensure that you can expand it and see under it the original ".certSigningRequest" used to generate the certificate
- At this moment you should be able to export it as ".p12"
- 打开证书:
open my_filename.cer
点击“查看证书”查看证书名称 - 转到应用程序 -> 实用程序 -> 钥匙串访问
- 确保您选择了“登录”钥匙串,而不是“系统”钥匙串(感谢@Matt Flettcher)
- 转到“证书”
- 查找所需的证书
- 确保您可以展开它并在其下方看到用于生成证书的原始“.certSigningRequest”
- 此时您应该可以将其导出为“.p12”
回答by LaBUBU
try this: given you have files as follow:
试试这个:假设你有如下文件:
aps.cer, downloaded from Apple.
app.key, your own private key generated by openssl.
aps.cer,从苹果下载。
app.key,你自己的由 openssl 生成的私钥。
1st, convert the .cer file into .pem format:
1、将 .cer 文件转换为 .pem 格式:
openssl x509 -in aps.cer -inform DER -out aps.pem -outform PEM
2nd, use the .pem file and your private .key to generate .p12 file:
2、使用 .pem 文件和你的私有 .key 生成 .p12 文件:
openssl pkcs12 -export -out aps.p12 -inkey app.key -in aps.pem
this should prompt to ask a password for this .p12 file.
这应该会提示询问此 .p12 文件的密码。
CF:
CF:
aps_developer_identity.cer to p12 without having to export from Key Chain?
回答by Stefan Ihmig
I had the same problem. .p12 Export was not available, only .p7b
我有同样的问题。.p12 导出不可用,只有 .p7b
I solved it very easily:
我很容易地解决了它:
You don′t select your certificate via the "certificates" directory on the lower left, but via the "My Certificates" directory.
您不是通过左下方的“证书”目录选择您的证书,而是通过“我的证书”目录。
Like this, an arrow should show up left of your certificate. Click it, and you will see your private Key.
像这样,您的证书左侧应显示一个箭头。单击它,您将看到您的私钥。
Right-Click on your private Key and select the "export Key" option. Now you can create a .p12 Certificate File, just as the doctor ordered.
右键单击您的私钥并选择“导出密钥”选项。现在您可以按照医生的要求创建 .p12 证书文件。
Good Luck!
祝你好运!
回答by whoami
In my case I'm trying to create a pfx/PKCS12 file and have tried the given commands and ran through couple of issues out of which one was : Unable to load certificateeven I'm doing right. So then tried with the below one command instead of few others:
就我而言,我正在尝试创建一个 pfx/PKCS12 文件,并尝试了给定的命令并解决了几个问题,其中一个问题是:即使我做得对,也无法加载证书。然后尝试使用下面的一个命令而不是其他几个命令:
openssl pkcs12 -export -out requiredPFXfile.pfx -inkey yourPrivateKey.key -in yourcertificate.cer
openssl pkcs12 -export -out requiredPFXfile.pfx -inkey yourPrivateKey.key -in yourcertificate.cer
Please find link for more details :- https://www.ssl.com/how-to/create-a-pfx-p12-certificate-file-using-openssl/
请查找链接以获取更多详细信息:- https://www.ssl.com/how-to/create-a-pfx-p12-certificate-file-using-openssl/
I'm newbie to SSL & certs stuff & can't judge on other answers,appreciate everyone's work here!!
我是 SSL 和证书的新手,无法判断其他答案,在这里感谢大家的工作!!