Search code examples
ssl-certificatep12keystore-access

How to convert a .cer to a .p12 file


I have two .cer files (developer and distribution) both are loaded into Keystore Access on Mac OS X. However I'm unable to export as a .p12 file.

ui

I tried OpenSSL, but still no luck:

openssl pkcs12 -export -in followMe_ios_development.cer -out followMe_ios_development.p12 -clcerts -nokeys

How can I export this .cer file as a .p12 so I can compile this app for iOS?


Solution

  • try this: given you have files as follow:

    aps.cer, downloaded from Apple.

    app.key, your own private key generated by openssl.

    1st, convert the .cer file into .pem format:

    openssl x509 -in aps.cer -inform DER -out aps.pem -outform PEM
    

    2nd, use the .pem file and your private .key to generate .p12 file:

    openssl pkcs12 -export -out aps.p12 -inkey app.key -in aps.pem
    

    this should prompt to ask a password for this .p12 file.

    CF:

    aps_developer_identity.cer to p12 without having to export from Key Chain?

    Creating a .p12 file