Re: AWS API Dlang, hmac sha256 function.

2015-10-12 Thread Marc Schütz via Digitalmars-d-learn
On Sunday, 11 October 2015 at 23:16:51 UTC, holo wrote: auto hmac_sha256(ubyte[] key, ubyte[] msg) { auto hmac = hmac!SHA256(key); hmac.put(msg); auto digest = hmac.finish; return digest; } alias

Re: AWS API Dlang, hmac sha256 function.

2015-10-12 Thread holo via Digitalmars-d-learn
Thank you for info, i changed my code to use that build in template and changed "cast(ubyte[]" to "xxx.representation" and it is still working: #!/usr/bin/rdmd -L-lcurl module sigawsv4; import std.stdio, std.process; import std.digest.sha, std.digest.hmac; import std.string; import

Re: AWS API Dlang, hmac sha256 function.

2015-10-11 Thread holo via Digitalmars-d-learn
After long fight with previous code i try to rewrite "one-to-one" python example from http://docs.aws.amazon.com/general/latest/gr/sigv4-signed-request-examples.html (GET part) from begging to D with full success. Here is working code in clear D. Im using hmac function which is available from

Re: AWS API Dlang, hmac sha256 function.

2015-10-10 Thread holo via Digitalmars-d-learn
On Friday, 9 October 2015 at 16:30:26 UTC, holo wrote: OK i find out error, in addRequestHeader i was using ":" after header name what casing problem. I removed it and now im getting "unauthorized". Here is how it looks right now: HTTP/1.1 401 Unauthorized\r\n [Expert Info

Re: AWS API Dlang, hmac sha256 function.

2015-10-09 Thread holo via Digitalmars-d-learn
OK i find out error, in addRequestHeader i was using ":" after header name what casing problem. I removed it and now im getting "unauthorized". Here is how it looks right now: HTTP/1.1 401 Unauthorized\r\n [Expert Info (Chat/Sequence): HTTP/1.1 401 Unauthorized\r\n] Request

Re: AWS API Dlang, hmac sha256 function.

2015-10-09 Thread holo via Digitalmars-d-learn
I correct typo (thats whats happening when you trying to solve problem after night at 6:00 AM ).But still have same error. When use curl with same generated creditentials im getting "400". What is strange when im using same generated headers and signature with command line curl im getting

Re: AWS API Dlang, hmac sha256 function.

2015-10-08 Thread holo via Digitalmars-d-learn
I was fighting with it a little bit and after all i just leave original function which was in code, removed dependencies from vibe.d and finally tried to contact api. Here is my present code: #!/usr/bin/rdmd -L-lcurl import std.stdio; import std.string; import std.file; import std.datetime;

Re: AWS API Dlang, hmac sha256 function.

2015-10-08 Thread Laeeth Isharc via Digitalmars-d-learn
On Friday, 9 October 2015 at 04:04:57 UTC, holo wrote: r.dateString = client.addRequestHeader("Authoryzation:", "AWS4-HMAC-SHA256" ~ " " ~ "Credential=" ~ accKey ~ "/" ~ xamztime ~ "/" ~ zone ~ "/" ~ service ~ "/" ~ "aws4_request" ~ ", " ~ "SignedHeaders=" ~ "content-type;host;x-amz-date" ~

Re: AWS API Dlang, hmac sha256 function.

2015-10-06 Thread holo via Digitalmars-d-learn
Congrats on getting it working! @Rikki Thanks :) I was trying to write my own lib from beginning based on examples but after some time i resign from that idea (will back to it when i will have some more experience) and right now im trying to customize that one from link which yawniek paste:

Re: AWS API Dlang, hmac sha256 function.

2015-10-06 Thread Rikki Cattermole via Digitalmars-d-learn
On 07/10/15 3:18 PM, holo wrote: Congrats on getting it working! @Rikki Thanks :) I was trying to write my own lib from beginning based on examples but after some time i resign from that idea (will back to it when i will have some more experience) and right now im trying to customize that one

Re: AWS API Dlang, hmac sha256 function.

2015-10-05 Thread Rikki Cattermole via Digitalmars-d-learn
On 06/10/15 11:26 AM, holo wrote: On Monday, 5 October 2015 at 21:00:38 UTC, Vladimir Panteleev wrote: On Monday, 5 October 2015 at 19:43:39 UTC, holo wrote: @Vladimir where can i check or do you know when next version of phobos will be available? You can use Digger to get the latest version

Re: AWS API Dlang, hmac sha256 function.

2015-10-05 Thread holo via Digitalmars-d-learn
On Saturday, 3 October 2015 at 23:58:39 UTC, Rikki Cattermole wrote: On 04/10/15 2:31 AM, holo wrote: On Saturday, 3 October 2015 at 12:50:58 UTC, Rikki Cattermole wrote: On 04/10/15 1:49 AM, holo wrote: On Saturday, 3 October 2015 at 12:22:11 UTC, Rikki Cattermole wrote: On 04/10/15 1:09

Re: AWS API Dlang, hmac sha256 function.

2015-10-05 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 5 October 2015 at 19:43:39 UTC, holo wrote: @Vladimir where can i check or do you know when next version of phobos will be available? You can use Digger to get the latest version of D: https://github.com/CyberShadow/Digger

Re: AWS API Dlang, hmac sha256 function.

2015-10-05 Thread holo via Digitalmars-d-learn
On Monday, 5 October 2015 at 21:00:38 UTC, Vladimir Panteleev wrote: On Monday, 5 October 2015 at 19:43:39 UTC, holo wrote: @Vladimir where can i check or do you know when next version of phobos will be available? You can use Digger to get the latest version of D:

Re: AWS API Dlang, hmac sha256 function.

2015-10-03 Thread Rikki Cattermole via Digitalmars-d-learn
On 04/10/15 1:09 AM, holo wrote: On Saturday, 3 October 2015 at 05:02:58 UTC, Rikki Cattermole wrote: On 03/10/15 6:01 PM, Rikki Cattermole wrote: On 03/10/15 4:54 PM, holo wrote: On Saturday, 3 October 2015 at 03:15:21 UTC, Rikki Cattermole wrote: You could implement it yourself, (it looks

Re: AWS API Dlang, hmac sha256 function.

2015-10-03 Thread Rikki Cattermole via Digitalmars-d-learn
On 04/10/15 1:49 AM, holo wrote: On Saturday, 3 October 2015 at 12:22:11 UTC, Rikki Cattermole wrote: On 04/10/15 1:09 AM, holo wrote: On Saturday, 3 October 2015 at 05:02:58 UTC, Rikki Cattermole wrote: On 03/10/15 6:01 PM, Rikki Cattermole wrote: On 03/10/15 4:54 PM, holo wrote: [...]

Re: AWS API Dlang, hmac sha256 function.

2015-10-03 Thread yawniek via Digitalmars-d-learn
On Saturday, 3 October 2015 at 03:11:06 UTC, holo wrote: Hello I'm trying to contact AWS API with D according to documentation: [...] check https://github.com/yannick/vibe-aws it has v4 implemented

Re: AWS API Dlang, hmac sha256 function.

2015-10-03 Thread holo via Digitalmars-d-learn
On Saturday, 3 October 2015 at 12:22:11 UTC, Rikki Cattermole wrote: On 04/10/15 1:09 AM, holo wrote: On Saturday, 3 October 2015 at 05:02:58 UTC, Rikki Cattermole wrote: On 03/10/15 6:01 PM, Rikki Cattermole wrote: On 03/10/15 4:54 PM, holo wrote: [...] By the looks of that error message

Re: AWS API Dlang, hmac sha256 function.

2015-10-03 Thread holo via Digitalmars-d-learn
On Saturday, 3 October 2015 at 12:50:58 UTC, Rikki Cattermole wrote: On 04/10/15 1:49 AM, holo wrote: On Saturday, 3 October 2015 at 12:22:11 UTC, Rikki Cattermole wrote: On 04/10/15 1:09 AM, holo wrote: [...] By the looks of things the problem is with SHA256, I'm guessing it doesn't have

Re: AWS API Dlang, hmac sha256 function.

2015-10-03 Thread holo via Digitalmars-d-learn
On Saturday, 3 October 2015 at 05:02:58 UTC, Rikki Cattermole wrote: On 03/10/15 6:01 PM, Rikki Cattermole wrote: On 03/10/15 4:54 PM, holo wrote: On Saturday, 3 October 2015 at 03:15:21 UTC, Rikki Cattermole wrote: You could implement it yourself, (it looks pretty easy). Or go the route of

Re: AWS API Dlang, hmac sha256 function.

2015-10-03 Thread Vladimir Panteleev via Digitalmars-d-learn
On Saturday, 3 October 2015 at 03:11:06 UTC, holo wrote: Last but not least, how to write such function in D: def sign(key, msg): return hmac.new(key, msg.encode("utf-8"), hashlib.sha256).digest() ? I can't find in standard libraryt hmac function, is it existing? The next version of D

Re: AWS API Dlang, hmac sha256 function.

2015-10-03 Thread Rikki Cattermole via Digitalmars-d-learn
On 04/10/15 2:31 AM, holo wrote: On Saturday, 3 October 2015 at 12:50:58 UTC, Rikki Cattermole wrote: On 04/10/15 1:49 AM, holo wrote: On Saturday, 3 October 2015 at 12:22:11 UTC, Rikki Cattermole wrote: On 04/10/15 1:09 AM, holo wrote: [...] By the looks of things the problem is with

Re: AWS API Dlang, hmac sha256 function.

2015-10-02 Thread Rikki Cattermole via Digitalmars-d-learn
On 03/10/15 6:01 PM, Rikki Cattermole wrote: On 03/10/15 4:54 PM, holo wrote: On Saturday, 3 October 2015 at 03:15:21 UTC, Rikki Cattermole wrote: You could implement it yourself, (it looks pretty easy). Or go the route of Botan:

Re: AWS API Dlang, hmac sha256 function.

2015-10-02 Thread Rikki Cattermole via Digitalmars-d-learn
On 03/10/15 4:54 PM, holo wrote: On Saturday, 3 October 2015 at 03:15:21 UTC, Rikki Cattermole wrote: You could implement it yourself, (it looks pretty easy). Or go the route of Botan: https://github.com/etcimon/botan/blob/3bdc835d5b9bad7523deaa86fe98b1fbb2f09d6b/source/botan/mac/hmac.d

AWS API Dlang, hmac sha256 function.

2015-10-02 Thread holo via Digitalmars-d-learn
Hello I'm trying to contact AWS API with D according to documentation: http://docs.aws.amazon.com/general/latest/gr/sigv4_signing.html there is written example in python which i want to rewrite to D: http://docs.aws.amazon.com/general/latest/gr/sigv4-signed-request-examples.html I want to

Re: AWS API Dlang, hmac sha256 function.

2015-10-02 Thread Rikki Cattermole via Digitalmars-d-learn
On 03/10/15 4:11 PM, holo wrote: Hello I'm trying to contact AWS API with D according to documentation: http://docs.aws.amazon.com/general/latest/gr/sigv4_signing.html there is written example in python which i want to rewrite to D:

Re: AWS API Dlang, hmac sha256 function.

2015-10-02 Thread holo via Digitalmars-d-learn
On Saturday, 3 October 2015 at 03:15:21 UTC, Rikki Cattermole wrote: You could implement it yourself, (it looks pretty easy). Or go the route of Botan: https://github.com/etcimon/botan/blob/3bdc835d5b9bad7523deaa86fe98b1fbb2f09d6b/source/botan/mac/hmac.d Thank you for answer. I used dub to