You are here

public function LingotekOAuthSignatureMethod_RSA_SHA1::verify in Lingotek Translation 7.6

Same name and namespace in other branches
  1. 7.7 lib/oauth-php/library/signature_method/LingotekOAuthSignatureMethod_RSA_SHA1.php \LingotekOAuthSignatureMethod_RSA_SHA1::verify()
  2. 7.4 lib/oauth-php/library/signature_method/LingotekOAuthSignatureMethod_RSA_SHA1.php \LingotekOAuthSignatureMethod_RSA_SHA1::verify()
  3. 7.5 lib/oauth-php/library/signature_method/LingotekOAuthSignatureMethod_RSA_SHA1.php \LingotekOAuthSignatureMethod_RSA_SHA1::verify()

* Check if the request signature is the same as the one calculated for the request. * *

Parameters

LingotekOAuthRequest request: * @param string base_string * @param string consumer_secret * @param string token_secret * @param string signature * @return string

Overrides LingotekOAuthSignatureMethod::verify

File

lib/oauth-php/library/signature_method/LingotekOAuthSignatureMethod_RSA_SHA1.php, line 117

Class

LingotekOAuthSignatureMethod_RSA_SHA1

Code

public function verify($request, $base_string, $consumer_secret, $token_secret, $signature) {
  $decoded_sig = base64_decode($request
    ->urldecode($signature));

  // 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 computed 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;
}