You are here

public function OAuthSignatureMethod_RSA_SHA1::check_signature in OAuth 1.0 6

Same name and namespace in other branches
  1. 6.3 lib/OAuth.php \OAuthSignatureMethod_RSA_SHA1::check_signature()
  2. 7.3 lib/OAuth.php \OAuthSignatureMethod_RSA_SHA1::check_signature()

Overrides OAuthSignatureMethod::check_signature

File

./OAuth.php, line 142

Class

OAuthSignatureMethod_RSA_SHA1

Code

public function check_signature(&$request, $consumer, $token, $signature) {

  /*{{{*/
  $decoded_sig = base64_decode($signature);
  $base_string = $request
    ->get_signature_base_string();

  // Fetch the public key cert based on the request
  $cert = $this
    ->fetch_public_cert($request);

  //Pull the public key ID from the certificate
  $publickeyid = openssl_get_publickey($cert);

  //Check the computer signature against the one passed in the query
  $ok = openssl_verify($base_string, $decoded_sig, $publickeyid);

  //Release the key resource
  openssl_free_key($publickeyid);
  return $ok == 1;
}