public function LingotekOAuthSignatureMethod_RSA_SHA1::signature in Lingotek Translation 7.7
Same name and namespace in other branches
- 7.4 lib/oauth-php/library/signature_method/LingotekOAuthSignatureMethod_RSA_SHA1.php \LingotekOAuthSignatureMethod_RSA_SHA1::signature()
- 7.5 lib/oauth-php/library/signature_method/LingotekOAuthSignatureMethod_RSA_SHA1.php \LingotekOAuthSignatureMethod_RSA_SHA1::signature()
- 7.6 lib/oauth-php/library/signature_method/LingotekOAuthSignatureMethod_RSA_SHA1.php \LingotekOAuthSignatureMethod_RSA_SHA1::signature()
* Calculate the signature using RSA-SHA1 * This function is copyright Andy Smith, 2008. * *
Parameters
LingotekOAuthRequest request: * @param string base_string * @param string consumer_secret * @param string token_secret * @return string
Overrides LingotekOAuthSignatureMethod::signature
File
- lib/
oauth-php/ library/ signature_method/ LingotekOAuthSignatureMethod_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));
}