Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Export push notification certificate as P12

Normally, I can export the certificate from the keychain that I download from the apple member center as a p12 file. However, it seems that Apple may have changed something?!

I require it as a p12 to import it into Amazon's SNS service. I have tried converting to PEM files but it's producing an error on the console.

enter image description here

like image 572
Allreadyhome Avatar asked Apr 12 '16 15:04

Allreadyhome


3 Answers

You can't export to a .p12 because you don't have the private key installed on your machine (if you did, you would have an "expand" arrow next to the certificate like your iPhone Distribution certificate has.) You will need to get the private key from the machine that generated the certificate before you export.

like image 95
BevTheDev Avatar answered Nov 14 '22 22:11

BevTheDev


The solution I have found has been posted here: https://stackoverflow.com/a/19502944/1198404

I copy and paste the answer: Turns out all you have to do is select "My Certificates" on the left panel and it enables the .p12 option.

like image 28
chelder Avatar answered Nov 15 '22 00:11

chelder


If the accepted answer doesn't apply to you (e.g., because you created the CSR from the same Mac, and should have the private key on this Mac), here's one more possibility:

When you happen to have selected the wrong keychain (like if you accidentally had single clicked on the System keychain rather than Login keychain), you may run into the same problem. If the cert signing request came from that machine, it would associate the private key with the Login keychain (at least, that seems to be the default). So if you somehow then downloaded and imported the certificate into another keychain like the System keychain (or iCloud keychain, as some comments have mentioned), Keychain Access would not find the matching private key and would not put the cert under "My certificates", and so it cannot export a p12. It would be similar to the case of importing to the keychain on a different Mac.

Make sure the import is into the keychain associated with the private key. Often this would be the Login keychain.

like image 24
auspicious99 Avatar answered Nov 14 '22 23:11

auspicious99