sarpay
8/14/2014 - 9:21 AM

[ios] [mobile] [crypto] Creating an APNS Certificate & .p12 File

[ios] [mobile] [crypto] Creating an APNS Certificate & .p12 File

1. Open Keychain Access
2. From menu > Certificate Assistant > Request Cert from Authority
3. type apple id as email (xxxxx@gmail.com)
4. type a name into Common Name (ex: IntroMoney - APNS - Production)
5. Select Save to Disk
6. Select "Let me Specify key pair info"
7. Hit Continue
8. Select 2048 and RSA
9. Create CSR.
10. You should see a public and a private key created under the "Keys" category.
11. Open Apple Developer Portal
12. Select All Certificates and Hit the plus sign to create a new one
13. Select Cert type and Next and Next
14. Upload CSR and Create the Cert.
15. Download and import the Cert into "Login" keychains (where the CSR was created)
16. Using Keychain Access; File > Import Items.
17. Under My Certificates, expand the cert and right click the private key
18. Export as p12 with the same password from Pushwoosh
19. Upload Cert and p12 files to Pushwoosh

======================================================
======================================================
======================================================

In order to find out if a provision profile includes APNS enabled.
Open terminal and paste the below.

/usr/libexec/PlistBuddy -c 'Print :Entitlements' /dev/stdin <<< $(security cms -D -i /Users/sarpay/Desktop/JustFacts-v2-certs/JustFacts-v2-AdHoc.mobileprovision)

Sample Output:
--------------
Dict {
    get-task-allow = false
    aps-environment = production
    com.apple.developer.team-identifier = VU3GFSGK56M
    application-identifier = VU3GFSGK56M.com.thelibertylab.justfacts
    keychain-access-groups = Array {
        VU3GFSGK56M.*
    }
}

======================================================
======================================================
======================================================
STEP 1: Create a “.certSigningRequest” (CSR)
  1. Open Keychain Access on your Mac (found in Applications/Utilities)
  2. In the main Keychain Access window, make sure that you don’t have a private key already              selected, otherwise this process will not work correctly
  3. From the toolbar, open Keychain Access > Preferences
  4. In the pop up window that appears, click the Certificates tab
  5. Set both “Online Certificate Status Protocol” and “Certificate Revocation List” to “Off”
  6. Close this window
  7. Back in the toolbar, open Keychain Access > Certificate Assistant > Request a Certificate From       a Certificate Authority
  8. Enter the email address and common name that  you used to register in the iOS Developer Program
    NOTE: This is the name that will appear in Keychain Access "Keys" list
    Leave the CA Email blank, and make sure “Saved to disk” is selected, and “Let me specify key        pair information” is checked
  9. Click Continue
    Choose a filename & destination on your hard drive
    (e.g. “certificate.certSigningRequest”)
  10. Click Save
  11. In the next window, for “Key Size” choose “2048 bits”
  12. For “Algorithm” choose “RSA”
  13. Click Continue
    This will create and save your certSigningRequest file (CSR) to your hard drive.
    A public and private key will also be created in Keychain Access with the Common Name you           entered earlier (e.g. Jo Smith)

STEP 2: Create the “.cer” file in your iOS Developer Account
  1. Log on to https://developer.apple.com
  2. Add a certificate
  3. Select the push notification type you want to create the certificate for
  4. Upload the CSR file generated above
  5. Download the .CER file.

STEP 3: Install the .cer and generate the .p12
  1. Find the .cer file you’ve just downloaded and double-click.
  2. Open up KeyChain Access again and select "Keys" to view the list of keys.
  3. Expand the “private key” profile, which should show the certificate you just added.
  4. Select the expanded certificate file, right click and choose the Export option.
  5. Name the file, select the format as .p12
  6. Specify a password
  7. Enter the system admin password to complete the export.