public function OAuthSignatureMethod_RSA_SHA1::verify in Lingotek Translation 7.2
Same name and namespace in other branches
- 7.3 lib/oauth-php/library/signature_method/OAuthSignatureMethod_RSA_SHA1.php \OAuthSignatureMethod_RSA_SHA1::verify()
* Check if the request signature is the same as the one calculated for the request. * *
Parameters
OAuthRequest request: * @param string base_string * @param string consumer_secret * @param string token_secret * @param string signature * @return string
Overrides OAuthSignatureMethod::verify
File
- lib/
oauth-php/ library/ signature_method/ OAuthSignatureMethod_RSA_SHA1.php, line 117
Class
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;
}