Skip to content
Search

Apple Push Notification Service

lastmod 2018-08-17created 2014-04-1618 edits

The Apple Push Notification Service is a service created by Apple Inc. that was launched together with iOS 3.0 on June 17, 2009. It uses push technology through a constantly open IP connection to forward notifications from the servers of third party applications to the Apple devices; such notifications may include badges, sounds or custom text alerts. In iOS 5, Notification Center enhanced the user experience of push and local notifications. APNs was also added as an API to Mac OS X v10.7 "Lion" for developers to take advantage of, and was greatly improved in OS X 10.8 "Mountain Lion" with the introduction of Notification Center.

Registering APNs

The procedure for registering APNs is as follows.

IOS_-_How_to_register_APNs_01.png

Go to "Identifiers" and select the registered App.

IOS_-_How_to_register_APNs_02.png

Click the "Edit" button at the bottom.

IOS_-_How_to_register_APNs_03.png

Under "Push Notifications", click the Development or Production
certificate creation button (Create Certificate).

IOS_-_How_to_register_APNs_04.png

Click the "Continue" button.

IOS_-_How_to_register_APNs_05.png

Create and select the certificate request file (CertificateSigningRequest.certSigningRequest), then
click the "Generate" button.
See here for how to create the certificate request file.

IOS_-_How_to_register_APNs_06.png

Download it.

You can see the following files:

  • CertificateSigningRequest.certSigningRequest: certificate request file.
  • aps_development.cer or aps_production.cer: APNs certificate issued by Apple.

Generating P12

You need to generate a p12 file to register with APNs.

IOS_-_How_to_generate_p12_01.png

Open the downloaded cer file to add it to the keychain.

IOS_-_How_to_generate_p12_02.png

"Export" the certificate file and the private key file.

IOS_-_How_to_generate_p12_03.png

Select "Personal Information Exchange (.p12)" and enter a file name.

IOS_-_How_to_generate_p12_04.png

Enter a password for the p12 file.

You can see the following files:

  • cert.p12: Personal Information Exchange file (certificate)
  • key.p12: Personal Information Exchange file (private key)

Generating PEM files

cert.pem: generate the Base64 encrypted certificate:

$ openssl pkcs12 -clcerts -nokeys -out cert.pem -in cert.p12

key.pem: generate the Base64 encrypted private key:

$ openssl pkcs12 -nocerts -out key.pem -in key.p12

key.unencrypted.pem: remove the password from the RSA private key:

$ openssl rsa -in key.pem -out key.unencrypted.pem

apns.pem: merge the certificate and private key (password removed) files.

$ cat cert.pem key.unencrypted.pem > ck.pem

See also

Favorite site

References


  1. Use_APNs_01.pdf ↩

  2. Use_APNs_02.pdf ↩

  3. Use_APNs_03.pdf ↩

  4. APNs_-_Register.pdf ↩

  5. APNs_-_Get_DeviceToken.pdf ↩

  6. In conclusion, you just need to register multiple certificates. ↩

  7. How_to_use_APNs_01.pdf ↩

  8. How_to_use_APNs_02.pdf ↩

  9. How_to_use_APNs_03.pdf ↩

  10. How_to_use_APNs_04.pdf ↩

  11. How_to_use_APNs_05.pdf ↩

  12. How_to_use_APNs_06.pdf ↩

  13. JAVA_-_GCM_and_APNS.pdf ↩