function sign_rsa_sha1 in Dropbox Client 7.3
Same name and namespace in other branches
- 7.4 oauth.php \sign_rsa_sha1()
- 7 oauth.php \sign_rsa_sha1()
- 7.2 oauth.php \sign_rsa_sha1()
Signs an array of oauth parameters according to the 1.0 spec using the rsa-sha1 hasing algorithm
Parameters
string $method either GET or POST:
string $baseurl the baseurl we are authenticating againts:
string $certfile the location of your private certificate file:
array $parameters all parameters that need to be signed:
Return value
string the signature
1 call to sign_rsa_sha1()
- build_auth_array in ./
oauth.php - Assemble an associative array with oauth values
File
- ./
oauth.php, line 79
Code
function sign_rsa_sha1($method, $baseurl, $certfile, array $parameters) {
$fp = fopen($certfile, "r");
$private = fread($fp, 8192);
fclose($fp);
$data = $method . '&';
$data .= urlencode($baseurl) . '&';
$oauth = '';
ksort($parameters);
foreach ($parameters as $key => $value) {
$oauth .= "&{$key}={$value}";
}
$data .= urlencode(substr($oauth, 1));
$keyid = openssl_get_privatekey($private);
openssl_sign($data, $signature, $keyid);
openssl_free_key($keyid);
return base64_encode($signature);
}