Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 591
Gopinath Avatar asked May 02 '12 06:05

Gopinath


2 Answers

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.

like image 128
ulu5 Avatar answered Nov 15 '22 07:11

ulu5


Open the terminal and click ls to list the items in the current directory,

then if you are not in the folder in which the .p12 is having move to the correct directory by

cd directory path

for example,

cd Downloads

Then list the files using and make sure the .p12 file are existing in the directory.

Then convert the .p12 file to .pem file using the following command.

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

The .pem file which you have created will be saved in the directory which is having the .p12 file.

like image 41
Varun P V Avatar answered Nov 15 '22 07:11

Varun P V