Search code examples
iospush-notificationcertificateapple-push-notificationspem

Can I convert p8 APNs Auth Key to pem file?


I using *.p8 APNs Auth Keys instead of *.p12 certificates for push notification of my apps.

And, push notifications were working well.

However, a third party SDK which I needed and related to push notification demands only *.pem files from me, not *.p8.

If I want to use only *.p8 for APNs, I can't use this SDK now. It's right?


Solution

  • You can do this by using openssl. You can convert the .p8 to .pem using below command:

    If the .p8 private key is encrypted:

    openssl pkcs8 -in AuthKey.p8 -out AuthKey.pem
    

    If the .p8 private key is not encrypted:

    openssl pkcs8 -nocrypt -in AuthKey.p8 -out AuthKey.pem
    

    APNS and Sign in with Apple *.p8 keys, provided by Apple are unencrypted.