How to generate the p12 file for my phonegap build?

1

My company made a developer certificate on the Apple Developer platform. At this point I need to link a key file to my iOS build in Phonegap.

I'm trying to generate this key file where I need the .p12 file and the provisioning profile file. I've got myself the provisioning profile file, but I can't seem to generate the .p12 file.

I'm using Openssl to generate my files and I tried this command to generate the last file:

openssl pkcs12 -export -inkey ios.key -in ios_development.pem -out ios_development.p12
Enter pass phrase for ios.key: *********
No certificate matches private key

What exactly am I doing wrong here? Can I find the private key on the developer.apple.com website?

UPDATE: here are the steps I'm performing to get to this problem:

  1. Generate private key: openssl genrsa -des3 -out ios.key 2048 and enter a password pass123
  2. Generate CSR file: openssl req -new -key ios.key -out ios.csr -subj "/emailAddress=info@company.com, CN=company, C=BE" and enter the password from the private key pass123
  3. Go to your Apple Developer iOS Provisioning Portal and download the development certificate .cer file
  4. Convert the certificate to a PEM file: openssl x509 -in ios_development.cer -inform DER -out ios_development.pem -outform PEM
  5. Generate the P12 file using the private key (ios.key) and the iOS development certificate (ios_development.pem): openssl pkcs12 -export -inkey ios.key -in ios_development.pem -out ios_development.p12 and enter the password from the private key pass123
  6. Error message: No certificate matches private key

Jordec

Posted 2016-05-30T12:24:40.843

Reputation: 141

Answers

1

The cause of my problem was that we deleted the certificate from the Keychain Access. This caused or private and public keys to dissapear aswell, making it impossible to extract the p12 file.

I fixed the problem by regenerating the certificate from scratch.

More details can be found here: Can't seem to export a p12 file

Jordec

Posted 2016-05-30T12:24:40.843

Reputation: 141