Skip to content

Instantly share code, notes, and snippets.

@yurkinx
Last active August 29, 2015 14:18
Show Gist options
  • Save yurkinx/c0f7e1ed4c464fc26bea to your computer and use it in GitHub Desktop.
Save yurkinx/c0f7e1ed4c464fc26bea to your computer and use it in GitHub Desktop.
Copy paste tutorial to creat keys for Apple Push Notification service on Mac
Use this: http://docs.aws.amazon.com/sns/latest/dg/mobile-push-apns.html
Prepare:
1. Create folder "Certificates" in the "Documents" folder.
Do:
1. Go: https://developer.apple.com/account/ios/certificate/certificateCreate.action
2. Select: Apple Push Notification service SSL (Sandbox)
3. On your Mac open Keychain Access. In the drop down menu, select Keychain Access >
Certificate Assistant > Request a Certificate from a Certificate Authority.
In the Certificate Information window, enter the following information:
In the User Email Address field, enter your email address.
In the Common Name field, create a name for your private key (e.g., John Doe Dev Key).
The CA Email Address field should be left empty.
In the "Request is" group, select the "Saved to disk" option.
Save to "Documents/Certificates" folder
Upload this certificate request.
Click Continue within Keychain Access to complete the CSR generating process.
4. Download newly created certificate to "Documents/Certificates" folder, click to install. Select "Login"
5. In Terminal cd to "Documents/Certificates" and type:
openssl x509 -in aps_development.cer -inform DER -out aps_development.pem
6. In KeyChain access "login" > "certificates" > select "apple deelopment push services" > open to view private key > select
7. In open menu select "Export ..." save as "apnsprivatekey.p12" to "Documents/Certificates" folder, create password
8. Create private .pem: Open Terminal, cd to "Documents/Certificates". Type: openssl pkcs12 -in apnsprivatekey.p12 -out apnsprivatekey.pem -nodes -clcerts
9. Go: https://www.entrust.net/downloads/root_request.cfm
10. Select "root certificates", download "entrust_2048_ca.cer" to "Documents/Certificates"
11. Click to install it in the "System"
12. Check connection is good. In Terminal type: openssl s_client -connect gateway.sandbox.push.apple.com:2195 -CAfile entrust_2048_ca.cer
13. Should return "Verify return code: 0 (ok)" at the end. If not, proceed to 14 anyway
14. In Terminal type: openssl s_client -connect gateway.sandbox.push.apple.com:2195 -cert aps_development.pem -key apnsprivatekey.pem
15. If the connection is successful, you should be able to type a few characters. When you hit enter, the server should disconnect.
16. type: php apns.php to test the cert
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment