public function OAuthSignatureMethod_RSA_SHA1::signature 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::signature()
* Calculate the signature using RSA-SHA1 * This function is copyright Andy Smith, 2008. * *
Parameters
OAuthRequest request: * @param string base_string * @param string consumer_secret * @param string token_secret * @return string
Overrides OAuthSignatureMethod::signature
File
- lib/
oauth-php/ library/ signature_method/ OAuthSignatureMethod_RSA_SHA1.php, line 88
Class
Code
public function signature($request, $base_string, $consumer_secret, $token_secret) {
// Fetch the private key cert based on the request
$cert = $this
->fetch_private_cert($request);
// Pull the private key ID from the certificate
$privatekeyid = openssl_get_privatekey($cert);
// Sign using the key
$sig = false;
$ok = openssl_sign($base_string, $sig, $privatekeyid);
// Release the key resource
openssl_free_key($privatekeyid);
return $request
->urlencode(base64_encode($sig));
}