Re: SHA256 [was: Date time iso8601 format]

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: SHA256 [was: Date time iso8601 format]

laurent laffont
req :=  'Service=AWSECommerceService&AWSAccessKeyId=mykey&Operation=ItemLookup&ItemId=3952334146&Timestamp=', DateAndTime now printString.
sign :=SHA256 hashMessage:  'GET', String crlf, 'ecs.amazonaws.com', String crlf, '/onca/xml',String crlf,req.


(Url absoluteFromText: 'http://webservices.amazon.fr/onca/xml?',req, '&Signature=',sign hex) retrieveContents contentStream.

Wenn did you do the encodeForHTTP? You need it in any case because at least the + sign is an encoded space that will render the date invalid. I think you need do safe url encoding only for the string if it is included in the url not the hash.


Yes, but then Amazon answers a signature not valid error. Indeed it seems I need to pass a secret key (given by Amazon) for SHA256 hash, but I  don't find how to pass it to a SHA256 object.

In PHP I would write: 
base64_encode(hash_mac('sha256', $signature, $secret_key)).

In Pharo ?


Laurent Laffont
 

Norbert

 

On 07 Nov 2010, at 13:50, laurent laffont wrote:

> The other way. For example
>
> DateAndTime now printISO8601
>
> Laurent
>
>
> On Sun, Nov 7, 2010 at 1:28 PM, Johan Brichau <[hidden email]> wrote:
> Laurent,
>
> DateAndTime readFrom: '2008-02-10T12:00:00Z' readStream
>
> Does that yield what you want?
>
> cheers
> Johan
>
> On 06 Nov 2010, at 15:07, laurent laffont wrote:
>
>> Hi,
>>
>> I cannot find which method to use to get a Date in iso 8601 format like '2008-02-10T12:00:00Z'  ?
>>
>>
>> Cheers,
>>
>> Laurent Laffont
>>
>> Pharo Smalltalk Screencasts: http://www.pharocasts.com/
>> Blog: http://magaloma.blogspot.com/
>
>