You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cloudstack.apache.org by Salar Darwish <sa...@gmail.com> on 2013/12/12 10:12:06 UTC

Signature

Hello,

I am very new with cloudstack and trying to generate a signature to reqeust
some simpel api's with php. I use the following script but still get the
error:

unable to verify user credentials and/or request signature

Can some one help me what is the mistake here. Thank you in advance

$apikey =
"apikey=BN_HAbfozXjgmwUFIFLtJ7wMkhxoN7Wn2kU0_0gtGed1wu7rZDw3yHbc4QjRN-PjJRkgY1EsCWYMBlwcf0k99Q";

$secretkey =
"IUobE620Jg3CCxNA_amoaWeoMjXh5GNU0zjhYfXjZGbq9JxOsnQlutF5VjDF3-fZ2715JEceteNqnN6bN3woqw";

$response = "response=json";

$urlcommand_deployvm = $apikey . "&command=listUsers" . "&" . $response;

$hashcommand = $apikey . "&". "command=listUsers" . "&". $response;

$query = str_replace("+", "%20", $hashcommand );

$lower = strtolower($hashcommand);

$hash = hash_hmac("SHA1", $lower, $secretkey . true, TRUE);

$base64encoded = base64_encode($hash);

$signature = "signature=" . urlencode($base64encoded);

$url = "http://localhost:8080/client/api?" . $urlcommand_deployvm . "&" .
$signature;


Kind regards,
Salar Darwish