如何使用终端将.p12文件转换为.pem文件?

Gop*_*ath 24 iphone terminal pkcs#12 pem ios

我已经有了development certificate in apple developer portal.我正在开发iPhone应用程序,我想在此应用程序中集成Apple推送通知.我创建了一个new App ID使用现有证书和enabled the Push Notification in this app id.我创建了一个new Provisioning Profile使用新创建的应用程序ID.在我创建和下载这些步骤之前.cer file from keychain access.完成这些步骤后,我created SSL (Apple Push Notification Service SSL certificate) file and installed在Mac Keychain Access中新下载了.一旦我安装了这个文件,验证(绿色刻度标记在那里)和got the .p12 file from this ssl file.

我按照苹果文档RemoteNotificationsPG.pdf,在他们提到保存.p12文件之后提到的这个文件中打开终端应用程序并输入以下内容,

openssl pkcs12 -in Certificates.p12 -out Certificates.pem -nodes
Run Code Online (Sandbox Code Playgroud)

我在我的终端应用程序中使用过这个,但出现的错误信息是,

Error opening input file Certificates.p12
Certificates.p12: No such file or directory
Run Code Online (Sandbox Code Playgroud)

你可以建议或指导我在哪里做错了或我在这些步骤中错过了什么?请帮我.提前致谢.

编辑:

我将Certificates.p12文件存储在桌面上.文件夹路径是Desktop->1/5/2012_Certificate->2/5/12->Certificates.p12

'ls' command在终端使用它没有列出我的Certificates.p12文件.

我输入了cd *path*这个返回No such file or directory.

请帮我.提前致谢.

ulu*_*lu5 8

你在正确的目录中吗?使用ls命令,它列出了Certificates.p12吗?

编辑:在终端类型:

ls
Run Code Online (Sandbox Code Playgroud)

这将列出您所在的当前目录的所有文件.如果未列出Certificates.p12,则表明您未在终端中的正确目录中.

要获取正确的目录类型:

cd *path*
Run Code Online (Sandbox Code Playgroud)

其中path是包含Certificates.p12的文件夹.输入cd后,您可以将该文件夹拖放到终端中.点击返回.然后运行openssl命令.


Var*_*P V 6

打开终端并单击ls列出当前目录中的项目,

那么如果您不在 .p12 所在的文件夹中,则通过以下方式移动到正确的目录

cd directory path
Run Code Online (Sandbox Code Playgroud)

例如,

cd Downloads
Run Code Online (Sandbox Code Playgroud)

然后列出使用的文件并确保目录中存在 .p12 文件。

然后使用以下命令将 .p12 文件转换为 .pem 文件。

openssl pkcs12 -in filename.p12 -out filename.pem -nodes
Run Code Online (Sandbox Code Playgroud)

您创建的 .pem 文件将保存在包含 .p12 文件的目录中。