Transform Apple Push Service Certificate To PEM Format For PHP Use

When you want to create an application for iOS with Apple Push Service, you need obtaining certificates from Apple Developer Center for the very Apple ID, one for Development and one for Production. The certificates you got from Apple are in the format of CER. However, for common PHP push sample, you need transform them into PEM format.

The following is the easy measure for transforming on Mac. For example, you would get CER from Apple, it may be named as APS.cer. And you can export a P12 certificate file from Keystore, after you import the very CER file by a double-click on it. Suppose the P12 file is named as APS.p12. Anyway, we need finally a PEM certificate, let us name it ApsDuo.pem as it may contains both key and certificate.

Basic Routine
APS.cer -> APS.p12 -> ApsDuo.pem

First step, convert APS.cer to ApsCert.pem.
openssl x509 -in APS.cer -inform der -out ApsCert.pem

Second step, convert APS.p12 to ApsKey.pem without certificate information.
openssl pkcs12 -nocerts -out ApsKey.pem -in APS.p12

Third step, link the two pem files as target ApsDuo.pem.
cat ApsCert.pem ApsKey.pem > ApsDuo.pem

Now you can use ApsDuo.pem for pushing!




このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください