How to make Safari Push Notifications App by PHP and JS

I wanna make Web App with Push Notifications.


now reading this Document.


https://developer.apple.com/library/mac/documentation/NetworkingInternet/Conceptual/NotificationProgrammingGuideForWebsites/PushNotifications/PushNotifications.html#//apple_ref/doc/uid/TP40013225-CH3-SW4


But faced with making Signature.


The Signature

The signature is a PKCS #7 detached signature of the manifest file. Sign the manifest file with the private key associated with your web push certificate that you obtained while registering with Apple. In PHP, you can do this with the

openssl_pkcs7_sign
function. The
create_signature
function in the attached
createPushPackage.php
companion file (the link is near the top of the page) shows how you can do this.

If the contents of your push package ever change, you’ll need to recompute your signature.

Important: After February 14, 2016, you will need to sign the push package with both the web push certificate and the intermediate certificate. The updated

create_signature
function in the attached
createPushPackage.php
companion file processes both certificates.


I tried to make Signature this code.


public function signature($package_dir) {
  $cert_data = "../pass_cert.pem";
  $private_key = "../key.pem";
  $AppleWWDRCA = "../AppleWWDRCA.pem";
  $signature_path = $package_dir . "/signature";

  if(openssl_pkcs7_sign(
  "$package_dir/manifest.json",
  $signature_path,
  $cert_data,
  $private_key,
  [],
  PKCS7_BINARY | PKCS7_DETACHED,
  $AppleWWDRCA
  ))
  {
  return;
  }
}


But it does not go well.


error message is below


Warning Error: openssl_pkcs7_sign(): error getting private key in


How can I make Signature and PushPackegaes?

Please Help Me.


[reference]

http://samuli.hakoniemi.net/how-to-implement-safari-push-notifications-on-your-website/

http://stackoverflow.com/questions/35432358/safari-push-notifications-certificate-issue/35433490#35433490?newreg=c4de0ee41c414aed81700c136022a033


Thanks in advance.

How to make Safari Push Notifications App by PHP and JS
 
 
Q