title: How to use hash_hmac() with "SHA256withRSA" on PHP?
body: <p>I'm trying to get PayPal Webhooks to work with my PHP app.
  The problem is the hashing algorithm they send via headers, that i must use to verify if the request is valid. </p>
  
  <p>When I try to use it, I get this error:</p>
  
  <pre><code>hash_hmac(): Unknown hashing algorithm: SHA256withRSA
  </code></pre>
  
  <p>I have tried hash_hmac using just the "sha256" algo and it worked, so I think the problem must be with the one they want me to use.</p>
  
  <p>Here is the code I use to process the Webhook:</p>
  
  <pre><code>$headers = apache_request_headers();
  
  $body = @file_get_contents('php://input');
  $json = json_decode($body);
  
  // Concatanate the reqired strings values
  $sigString = $headers['PAYPAL-TRANSMISSION-ID'].'|'.$headers['PAYPAL-TRANSMISSION-TIME'].'|'.$json-&gt;id.'|'.crc32($body);
  
  // Get the certificate file and read the key
  $pub_key = openssl_pkey_get_public(file_get_contents($headers['PAYPAL-CERT-URL']));
  $keyData = openssl_pkey_get_details($pub_key);
  
  // check signature
  if ($headers['PAYPAL-TRANSMISSION-SIG'] != hash_hmac($headers['PAYPAL-AUTH-ALGO'],$sigString,$keyData['key'])) {
      //invalid
  }
  </code></pre>