Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In the context of APNs, does p8 and p12 mean token and certificate based authentication respectively?

From what I know, PKCS 8 is often used to store private keys, and PKCS 12 is often used to store certificates.

And to communicate with APNs, you need authentication tokens or certificates.

https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html

Does that mean those .p8 files are keys used to create tokens, and those .p12 files are used as certificates?

like image 910
ntysdd Avatar asked Jan 29 '23 14:01

ntysdd


1 Answers

Yes. Apple Push Notification Authentication Key (P8 format) is used to generate Server side tokens. You do not need a certificate here. (This is mainly used when you have multiple apps under the same account as this key is same for all the apps unlike certificates). So using a same connection, your provider can talk to multiple apps using a mandatory 'authorization' header. Every post request gets validated henceforth by APNS cloud using this header.

P12 format exist for generating Certificates for authenticating provider against a particular AppID. Here for every individual app, a separate certificate is required. You do not need 'authorization' header here as connection itself is authenticated.

I hope it helps.

like image 175
Ayush Avatar answered Mar 17 '23 09:03

Ayush