简体   繁体   English

从钥匙串“我的证书”中导出p12文件

[英]Export p12 file from keychain “My Certificates”

I'm trying to export Certificate key "Apple Push Service" from MAC machine (for Google Cloud Messaging porpoises). 我正在尝试从MAC机(对于Google Cloud Messaging海豚)导出证书密钥“ Apple Push Service”。 this key I just created it with below steps from Apple web site 我刚刚通过Apple网站的以下步骤创建了此密钥

To manually generate a Certificate, you need a Certificate Signing Request (CSR) file from your Mac. 要手动生成证书,您需要Mac上的证书签名请求(CSR)文件。 To create a CSR file, follow the instructions below to create one using Keychain Access. 要创建CSR文件,请按照以下说明使用“钥匙串访问”来创建一个。

Create a CSR file. 创建一个CSR文件。

In the Applications folder on your Mac, open the Utilities folder and launch Keychain Access. 在Mac上的Applications文件夹中,打开Utilities文件夹并启动Keychain Access。

Within the Keychain Access drop down menu, select Keychain Access > Certificate Assistant > Request a Certificate from a Certificate Authority. 在“钥匙串访问”下拉菜单中,选择“钥匙串访问”>“证书助手”>“从证书颁发机构请求证书”。

  • In the Certificate Information window, enter the folwing information: In the User Email Address field, enter your email address. 在“证书信息”窗口中,输入以下信息:在“用户电子邮件地址”字段中,输入您的电子邮件地址。 In the Common Name field, create a name for your private key (eg, John Doe Dev Key). 在“公用名”字段中,为您的私钥(例如John Doe Dev Key)创建一个名称。 The CA Email Address field should be left empty. “ CA电子邮件地址”字段应保留为空。 In the "Request is" group, 在“请求为”组中,

    select the "Saved to disk" option. 选择“保存到磁盘”选项。

Click Continue within Keychain Access to complete the CSR generating process. 在“钥匙串访问”中单击“继续”以完成CSR生成过程。

I created the certificate the I need to export it to .p12 file to complete my process. 我创建了证书,需要将其导出到.p12文件以完成过程。

So I did the process as below (go to keychain and try to export) 所以我做了如下过程(去钥匙串并尝试导出) 在此输入图像描述

then when I try to write my password nothing happens, no error and no export (Nothing)!!!! 然后,当我尝试输入密码时,没有任何反应,没有错误,也没有导出(无)!!!!

在此输入图像描述

I'm sure my password is correct, and to be sure I reset my keychain "login" again , then restart the MAC machine, and try again, but still not working!! 我确定我的密码正确,并确保我再次重置了钥匙串“登录”,然后重新启动MAC机器,然后重试,但仍然无法正常工作!

I also tried to Export the key by command line below 我也尝试通过下面的命令行导出密钥

security export -k login.keychain -t all -f pkcs12 -P myPasswordHere

But not working too with below error 但是也无法解决以下错误

security: SecKeychainItemExport: A cryptographic verification failure has occurred.

I even tried to delete this certificate and redo it again, and even I tried to reset all my login keychain and redo everything anain, but this also didn't help!! 我什至试图删除此证书并再次重做,甚至我尝试重设所有登录钥匙串并重做所有别名,但这也无济于事!

Any help how can I export this certificate??? 任何帮助我如何导出此证书??? Thanks. 谢谢。

I knew the answer of my question and I thought to share it, it may help. 我知道我的问题的答案,因此我想与他人分享,可能会有所帮助。

That problem is due to I was try to export certificate from keychain using VNC remote. 该问题是由于我尝试使用VNC远程从钥匙串导出证书。 according to Apple site, from MAC update 10+ there is a security enhancement that prevent exporting certificate from keychain if you are using any remote tool, you should be able to do that only on the physical machine. 根据Apple网站的说法,从MAC更新10+开始,安全性得到了增强,可以防止使用任何远程工具从钥匙串中导出证书,您应该只能在物理计算机上执行此操作。

details in below link 以下链接中的详细信息

https://discussions.apple.com/thread/7305746?tstart=0 https://discussions.apple.com/thread/7305746?tstart=0

"the problem was working on these machines remotely via Apple Remote Desktop. With the 10.11.1 update, Apple introduced a "security fix" that disabled the ability for non-physical devices to interact with the Keychain. You can see the details of this "fix" here (scroll all the way to the bottom of the page and look for CVE-2015-5943 for a full description): “问题是通过Apple Remote Desktop远程在这些机器上工作。随着10.11.1更新,Apple引入了一个“安全修复程序”,该功能使非物理设备无法与钥匙串进行交互。您可以查看此详细信息在此处“修复”(滚动至页面底部,并查找CVE-2015-5943的完整说明):

About the security content of OS X El Capitan v10.11.1 and Security Update 2015-007 - Apple Support " 关于OS X El Capitan v10.11.1和安全性更新2015-007的安全性内容-Apple支持

You can confirm this being the issue with your machine if you view the system logs via the Console.app. 如果通过Console.app查看系统日志,则可以确认这是计算机的问题。 When you click on "Always Allow", you should see the following in the logs: 当您单击“始终允许”时,您应该在日志中看到以下内容:

Ignoring user action since the  dialog has received events from an untrusted source

Basically, your click is being registered as a "synthetic click". 基本上,您的点击已被注册为“合成点击”。 In my case, this was because I was using Apple Remote Desktop (I also tested various other remote apps I use, like TeamViewer and iTeleport Connect, and all resulted in the same error in the logs). 就我而言,这是因为我正在使用Apple Remote Desktop(我还测试了我使用的其他各种远程应用程序,例如TeamViewer和iTeleport Connect,并且在日志中均导致了相同的错误)。 Basically, this affects any screen sharing app. 基本上,这会影响所有屏幕共享应用。 My solution was to drive into the office and physically click "Always Allow" on each machine. 我的解决方案是开车进入办公室,然后在每台计算机上单击“始终允许”。 Yay. 好极了。 Thanks Apple! 谢谢苹果! Great "fix"!!! 很棒的“修复” !!!

After I went and try physical access to the MAC server, the problem solved and I was able to export certificate from the login KeyChain. 在尝试物理访问MAC服务器后,问题解决了,我能够从登录KeyChain导出证书。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM