This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Convert the .cer file into a .pem file: | |
$ openssl x509 -in aps.cer -inform der -out apns_cert_prod.pem | |
# Convert the private key’s .p12 file into a .pem file: | |
$ openssl pkcs12 -nocerts -in aps_production.p12 -out apns_key_prod.pem | |
# Finally, combine the certificate and key into a single .pem file | |
$ cat apns_cert_prod.pem apns_key_prod.pem > ck_prod.pem | |
# At this point it’s a good idea to test whether the certificate works. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Convert the .cer file into a .pem file: | |
$ openssl x509 -in aps_development.cer -inform der -out apns_cert_dev.pem | |
# Convert the private key’s .p12 file into a .pem file: | |
$ openssl pkcs12 -nocerts -in aps_development.p12 -out apns_key_dev.pem | |
# Finally, combine the certificate and key into a single .pem file | |
$ cat apns_cert_dev.pem apns_key_dev.pem > ck_dev.pem | |
# At this point it’s a good idea to test whether the certificate works. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.UnsupportedEncodingException; | |
import java.util.ArrayList; | |
import java.util.Properties; | |
import javax.mail.Message; | |
import javax.mail.MessagingException; | |
import javax.mail.PasswordAuthentication; | |
import javax.mail.Session; | |
import javax.mail.Transport; | |
import javax.mail.internet.InternetAddress; |