How to convert .p12 file to .pem file using Terminal?

Gopinath picture Gopinath · May 2, 2012 · Viewed 52.8k times · Source

I already have an development certificate in apple developer portal. Am developing an iPhone app,i want to integrate Apple Push Notification in this app. I have created a new App ID with used the existing certificate and enabled the Push Notification in this app id. And i have created a new Provisioning Profile used the newly created app id. Before these steps i have created and downloaded the .cer file from keychain access. After done these steps i downloaded the newly created SSL (Apple Push Notification Service SSL certificate) file and installed in my Mac Keychain Access. Once i installed this file, verified (Green tick mark is there) and got the .p12 file from this ssl file.

I followed the apple document RemoteNotificationsPG.pdf, in this document they mentioned after saved the .p12 file open the Terminal app and type below commends,

openssl pkcs12 -in Certificates.p12 -out Certificates.pem -nodes

I have used this in my Terminal app, but the error message is appear that is,

Error opening input file Certificates.p12
Certificates.p12: No such file or directory

Can you please suggest or guide me where i did wrong or what i missed in these steps? Please help me. Thanks in advance.

EDIT:

I stored my Certificates.p12 file in my desktop. Folder path is Desktop->1/5/2012_Certificate->2/5/12->Certificates.p12

I have used 'ls' command in Terminal it is not listing my Certificates.p12 file.

I have typed cd *path* this returned No such file or directory.

Please help me. Thanks in advance.

Answer

ulu5 picture ulu5 · May 2, 2012

Are you in the right directory? Use ls command, does it list Certificates.p12?

EDIT: In the terminal type:

ls

this will list all the files of the current directory that you are in. If Certificates.p12 is not listed, you are not in the correct directory in the terminal.

To get to the correct directory type:

cd *path*

where path is the folder containing Certificates.p12. You can drag and drop that folder into the terminal after typing cd. Hit return. Then run the openssl command.