Stuck creating p12 file for MoonAPNS

怎甘沉沦 提交于 2019-12-10 11:34:19

问题


I am having some trouble creating my .p12 certificate. I have previously created an application with push notification, this works fine. The application takes the users device id and saves it into a database.

I have added the code into my new application(with the amendments to work with the new application), and from the Log it seems to be working in the same way as my other app.

I have downloaded the relevant files that i need and then i know i needed to use ssl to be able to create my new and combined p12. I cant for the life of me remember how i created the p.12 file.

I'm using moonapns.

I have used the following:

Step 1:

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

Where aps_developer_identity.cer is the file you download from the portal

Step 2:

openssl pkcs12 -nocerts -out APSCertificates.pem -in APSCertificates.p12

Where APSCertificates.p12 is a file you export from the Mac Keychain. This is critical, you must import the certificate from the portal into keychain. Find it in My Certificates, open the disclosure triangle and highlight both the certificate and the private key, then right click and export them. Give them a password and save them to a p12 file.

Step 3:

openssl pkcs12 -export -in aps_developer_identity.pem -out aps_developer_identity.p12 -inkey APSCertificates.pem

I have added the certificate and it isn't working, i'm not receiving the notification to the device. Does any one know how else i am supposed to create the certificate??


回答1:


openssl pkcs12 -export -in your_app.pem -inkey your_key.pem -out your_app_key.p12

refer this link http://www.raywenderlich.com/forums/viewtopic.php?f=20&t=7468




回答2:


Try this:

After downloading the .cer file (aps_development certificate is not the ios_development), manages the pem file with the following command:

openssl x509 -in "path_to_apple_cert.cer" -inform DER -out "path_to_an_output_Cert.pem" -outform PEM

Take your APSCertificates.p12 file and run the second command:

openssl pkcs12 -nocerts -in "path_to_exported_p12_from_apple_cer.p12" -out "path_to_an_output_Key.pem" -passin pass:your_p12_password -passout pass:your_new_p12_password

Now take the two pem files that you generated and run the following command:

openssl pkcs12 -export -inkey "path_to_an_output_Key.pem" -in "path_to_an_output_Cert.pem" -out "path_to_final_p12.p12" -passin pass:your_new_p12_password -passout pass:your_final_p12_password

This is your P12 for push notifications.

If you do not want to use the

$ cat command PushChatCert.pem PushChatKey.pem > ck.pem

contained in some instances, if you are on windows you can use:

type PushChatCert.pem PushChatKey.pem > ck.pem


来源:https://stackoverflow.com/questions/18956915/stuck-creating-p12-file-for-moonapns

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!