Redth / PushSharp

A server-side library for sending Push Notifications to iOS (iPhone/iPad APNS), Android (C2DM and GCM - Google Cloud Message), Windows Phone, Windows 8, Amazon, Blackberry, and (soon) FirefoxOS devices!
Other
4.38k stars 1.52k forks source link

P8 File for APNs Token-Based Authentication #809

Open YoniH opened 7 years ago

YoniH commented 7 years ago

Hi, I'm using the latest code on apns-http2 branch, and trying to send push notifications to iOS devices, using token-based authentication.

I generated an APNs Auth Key in Apple's Dev Portal, and downloaded it (it's a file with p8 extension).

Am I supposed to load the p8 file to an X509Certificate2 object? Should the p8 file be converted to p12/pfx file first? If so, how?

sbryfcz commented 7 years ago

I would also like information on if this is supported.

m-lancieri commented 7 years ago

hi, any news?

Donnie7 commented 7 years ago

Did someone found a solution to this problem. I also need to know how can i load a p8 into X509Certificate.

zhouhao27 commented 7 years ago

Any news?

YoniH commented 7 years ago

Look here: https://stackoverflow.com/questions/42514289/how-to-use-apns-auth-key-p8-file-in-c

ErikDombi commented 4 years ago

@YoniH How do you convert that CngKey to an X509Certificate2?

Edit / Solution: Created a .p12 file using Keychain Access on my Mac.

  1. Open Keychain Access and select "My Certificates" under the "Category" header on the left side of the screen
  2. Select the certificate "Apple Push Services: [App Identifier]" (Don't select the private key below it)
  3. Right click the certificate you selected and chose "Export [Cert Name]" from the context menu
  4. You can save the Certificate as whatever name, just make sure File Format is set to "Personal Information Exchange (.p12)"

Use this .p12 file with the library