I wanna make Web App with Push Notifications.
now reading this Document.
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 attachedcreatePushPackage.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 inHow can I make Signature and PushPackegaes?
Please Help Me.
[reference]
http://samuli.hakoniemi.net/how-to-implement-safari-push-notifications-on-your-website/
Thanks in advance.