I am not very good at SSL and certificates. I used the message " How to use hash_hmac () with" SHA256withRSA "in PHP? " To find out if I can work with webcams using PayPal.
The problem I am facing is getting the following error after the call openssl_verify()
and return result (0):
OpenSSL error opensl_verify: 04091068: rsa procedure: INT_RSA_VERIFY: bad signature
I tried to solve this problem, but the documentation of errors and features on the Internet is minimal.
My current code is as follows:
$headers = apache_request_headers();
$body = @file_get_contents('php://input');
$json = json_decode($body);
$sigString = $headers['Paypal-Transmission-Id'].'|'.$headers['Paypal-Transmission-Time'].'|'.$json->id.'|'.crc32($body);
$pubKey = openssl_pkey_get_public(file_get_contents($headers['Paypal-Cert-Url']));
$verifyResult = openssl_verify($sigString, base64_decode($headers['Paypal-Transmission-Sig']), $pubKey, 'sha256WithRSAEncryption');
, , , openssl_pkey_get_details($pubKey)
, :
OpenSSL opensl_verify: 0906D06C: PEM: PEM_read_bio: OpenSSL opensl_verify: 04091068: rsa-: INT_RSA_VERIFY:
, base64_decode()
, (0) :
OpenSSL opensl_verify: 04091077: rsa-: INT_RSA_VERIFY:
?