PhoneGap Build - Unable to import Certificate

Error - Unable to import Certificate   Yes, I too, ran into this dreaded message while attempti

Error - Unable to import Certificate

 

Yes, I too, ran into this dreaded message while attempting to build our PhoneGap app for iOS. This problem occurs when PhoneGap’s build process attempts to sign your app with the certificate (the p12 file), you uploaded, using the credentials you provided. The P12 file contains your certificate and the matching private key. I must reiterate, these two information must match, in order for the PhoneGap build process to be able to sign your app.

There are couple things you can do to ensure your P12 is valid. The following instruction assumes you are enrolled with Apple Developer’s program. Remember, the sequence is important. So here we go.

  1. Generate a certificate request file. Just follow the “Generate a certificate signing request on Mac OS” section at: http://help.adobe.com/en_US/as3/iphone/... or 
    https://developer.apple.com/library/ios/...
  2. Here you will see your request file “xxxxxxxxx.certSigningRequest” in your machine (located at the destination you selected at step #1).
  3. Generate your certificate with your request file from step #2 by following the instruction.
    1. Login to your apple developer account.
    2. Go to the “Certificate Identifiers & Profiles->Certificates”.
    3. On the right hand corner select “+” to add your certificate.
    4. Follow the instruction and upload your “xxxxxxxxx.certSigningRequest” from step #2 when prompted to.
    5. Download your new certificate once your certificate generated from step #4 above.
  4. At this point, go back to your “Keychain Access” application. Select “Keys” under “Category”. You should see your key with the name you gave in step #1. Expand that key and you should see the certificate listed under it. If not, do the following.
    1. Import the certificate you downloaded in step #3, into the “Keychain Access” application.
    2. Validate with step #4 again.
  5. Right click on your key and “Export” your key to a P12 file. IMPORTANT. The password you give here, will be needed to unlock your certificate at PhoneGap build configuration.

    Please note, I’m assuming you already know how to generate the provision file. If not, log back into your Apple Developer’s account and create it there.

How to validate your P12 prior to uploading to PhoneGap build site?

  1. Open up “Keychain Access” application.
  2. Go to “File->Import Items”.
  3. Select your P12 file.
  4. Here the “Keychain Access” application will ask for the password you used during your P12 export.
  5. If the import works, then you are good to go.
  6. Otherwise, you must go back and read this article and validate again.