Can't find the app private key for the iOS app.

I need a private key (.p12 file) for my iOS app to enable push notifications via Amazon SNS. I cannot find the private key for my application in Keychain Access. I only see developer and distribution keys for myself and my company. I could remove it as I removed two app related things from Keychain Access in order to use the updated versions. I may have deleted the wrong thing. Can I recover keys in Xcode? If not, how can I create a new application to get new keys?

UPDATE: I found this tutorial detailing what I am trying to do. http://www.adventuresofanentrepreneur.net/creating-a-mobile-appsgames-company/setting-up-aws-sns-to-send-push-notifications-to-ios-devices Steps 4.1-4.5 are steps that I cannot execute. This is because there is no key for my application in my key-only keys. I tried to create a completely new application and repeat this process again and I don't have a key for this application either.

UPDATE 2: I found the following instructions which make me think there is something wrong with my Mac as it does not generate a key when I install the APN certificate downloaded from the Developer Center. http://kklolk.blogspot.co.uk/2013/11/amazon-sns-with-apple-apn.html

If I download the APN certificate and install it on my keychain, I can see the certificate on the keychain, but not the key. I have keys on my keychain for non-APN developers and distribution, but they fail openssl validation against Apple push servers listed in the tutorial

CONNECTED(00000003)
depth=1 C = US, O = "Entrust, Inc.", OU = www.entrust.net/rpa is incorporated by reference, OU = "(c) 2009 Entrust, Inc.", CN = Entrust Certification Authority - L1C
verify error:num=20:unable to get local issuer certificate
verify return:0
140735234900832:error:14094416:SSL routines:SSL3_READ_BYTES:sslv3 alert certificate unknown:s3_pkt.c:1256:SSL alert number 46
140735234900832:error:140790E5:SSL routines:SSL23_WRITE:ssl handshake failure:s23_lib.c:177:
---

      

I can use my non-APN.p12 files on the Amazon SNS New App page on AWS, but they give an error. The credentials you entered are not valid. Please enter valid credentials and try again.

I also tried combing the APN certificate generated for the app with the keys from the developer and distributor keys, which gave an error -There was a transient failure registering the app with Amazon SNS. Please try again (Request ID: Unknown).

The problem, of course, is that my computer is incorrectly generating keys from certificates for APN development and production.

+3


source to share


3 answers


I had the same problem. I found that you need to make sure that the certificate you are using to create the .p12 file from keychain access is the one you created using the CertificateSigningRequest file.



I went back to Apple Developer Center and generated another certificate for development purposes using the CertificateSigningRequest file. When I downloaded this and opened it in keychain access, the private key was now included. Exporting this private key pair to a .p12 file allowed me to successfully register the application with AWS SNS. Note that if you are using a development certificate to export your private key, you will need to create your app on SNS using the APNS Sandbox selection. If you are using a production certificate, you need to use the usual APNS selection.

+2


source


I found the answer here:

Cannot find the private key for Apple Development Push Services



For me, I already had a certificate, but I didn't know how to find its private key. If you click "My Certificates" by category, a down arrow will appear next to your certificate. Click this and you will receive your secret key.

+2


source


I have a preliminary answer for this. When creating a certificate in Keychain Access, first select iOS Developer or iOS Distribution, then go to Keychain Access> Certificate Assistant> Request a certificate from an authorized certificate using "iOS D ...".

The above in step 1 http://docs.aws.amazon.com/sns/latest/dg/mobile-push-apns.html#verify-cert-private-key-apns

Before I just went straight to the menu where I noticed it then said "Request a certificate from a CA using". The first time you select an iOS developer key, they become the key associated with the certificate upon import. This allows me to generate p12 as accepted by AWS. However, messaging to iOS devices still doesn't work, so it's not a complete success yet.

0


source







All Articles