Hey Salar,

The keys need to be in alphabetical order for you to calculate the correct
signature, (which you have in your example: [apiKey, command, response] but
you don't have a function to handle it)

apiKey has an upper case K in my code, maybe that's it?

- Ian


On Thu, Dec 12, 2013 at 2:18 PM, Salar Darwish <[email protected]>wrote:

> Thank you. I have already checked the cloudstack php client but still can
> not find the problem with my script.
>
>
> 2013/12/12 sebgoa <[email protected]>
>
> >
> > On Dec 12, 2013, at 10:14 AM, Salar Darwish <[email protected]>
> > wrote:
> >
> > > 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
> >
> > you might want to check this one out:
> >
> >
> >
> https://github.com/qpleple/cloudstack-php-client/blob/master/src/BaseCloudStackClient.php
> >
> >
> >
> > > 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;
> >
> >
>
>
> --
> *Met vriendelijke groet,*
> *Salar Darwish*
>

Reply via email to