简体   繁体   中英

Which file should we use on server for push notifications, .pem or .p12?

I want to send push notifications in my app. Which file I should upload to the server for push notifications, .p12 or .pem? If .p12, then what is the .pem file used for? I also checked some .NET and PHP code to see how they work.

// ("~/PushSharp.PushCert.Development.p12"))

C# used the .p12 file:

var appleCert = File.ReadAllBytes(System.Web.Hosting.HostingEnvironment.MapPath("~/PushSharp.PushCert.Development.p12"));

PHP used the .pem file:

$apnsCert = 'apns-dev.pem'; 

The difference between a .p12 file and a .pem is that the .p12 file containers both the public and private certicates used for encrypting the communication with Apple's push notification servers, whereas the .pem only contains the public certificate.

The one that you should be using on your server is the .pem file.

a little too late in the game, but what you definitely need is the p12. Make sure you give it a password. I just implemented it that way and it worked.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM