Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot convert apple developer_identity.cer into .p12 format. No certificate matches private key

i have following problem:

i have these files

developer_identity.cer

Team_Provisioning_Profile_.mobileprovision

In order to package adobe flex mobile application for iOS, i need to convert my .cer certificate into .p12 format. Following this tutorial on help.adobe.com i always get this problem when executing last openssl command:

"no certificate matches private key
error in pkcs12"

From what i understand i need somehow to get private key, that was used to create the certificate (do i understand this well??). How do i get the private key mykey.key if i only have .cer and .mobileprovision files mentioned above?

like image 809
hendrix Avatar asked Jan 20 '12 13:01

hendrix


People also ask

How do I convert an Apple Developer Certificate to a PEM?

Convert the developer certificate file you receive from Apple into a PEM certificate file. Run the following command-line statement from the OpenSSL bin directory: If you are using the private key from the keychain on a Mac computer, convert it into a PEM key:

How to generate a P12 file from an iPhone Developer Certificate?

If you are using the private key from the keychain on a Mac computer, convert it into a PEM key: You can now generate a valid P12 file, based on the key and the PEM version of the iPhone developer certificate: If you are using a key from the Mac OS keychain, use the PEM version you generated in the previous step.

Can I generate a P12 file from a CER file?

The .cer does not contain your private key and you cannot generate your .p12 file from it. You have to export them both at the same time from keychain. If you only have the .cer file, it's useless and you will have to create a new private key and certificate pair. Not sure you can get your private key if you lost it.

Where is the Apple signing certificate stored?

The certificate is public and often stored in an unencrypted .pem file. The key is private and often stored in the Keychain or an encrypted .p12 file. You can ask Apple for a new signing certificate, using a new private key and CSR. This does not require administrator access or access to the existing Keychain.


1 Answers

OpenSSL says no certificate matches private key when the certificate is DER-encoded. Just change it to PEM encoding before creating the PKCS#12.

  1. Create key pair : openssl genrsa -out aps_development.key 2048

  2. Create CSR : openssl req -new -sha256 -key aps_development.key -out aps_development.csr

  3. Upload the CSR to developer portal to get the certificate aps_development.cer

  4. Convert the certificate: openssl x509 -inform DER -outform PEM -in aps_development.cer -out aps_development.pem

  5. Build the PKCS#12: openssl pkcs12 -inkey aps_development.key -in aps_development.pem -export -out aps_development.p12

like image 59
codecontext Avatar answered Sep 22 '22 08:09

codecontext