www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - sign oauth request

reply "szabo bogdan" <szabobogdan yahoo.com> writes:
Hi,

How I can sign a request for flickrl oauth api?
https://www.flickr.com/services/api/auth.oauth.html#request_token

there is no HMAC-SHA1 algorithm in phobos library... should I 
implement it from scratch?

Thanks,
Bogdan
Sep 25 2014
next sibling parent reply "H. S. Teoh via Digitalmars-d-learn" <digitalmars-d-learn puremagic.com> writes:
On Thu, Sep 25, 2014 at 03:57:36PM +0000, szabo bogdan via Digitalmars-d-learn
wrote:
 Hi,
 
 How I can sign a request for flickrl oauth api?
 https://www.flickr.com/services/api/auth.oauth.html#request_token
 
 there is no HMAC-SHA1 algorithm in phobos library... should I implement it
 from scratch?
[...] Implementing cryptographic algorithms on your own is probably not a good idea. Your safest bet is to use one of the many C authentication libraries out there, since D can call C functions directly. T -- Once the bikeshed is up for painting, the rainbow won't suffice. -- Andrei Alexandrescu
Sep 25 2014
parent "szabo bogdan" <szabobogdan yahoo.com> writes:
which lib do you recommand?


On Thursday, 25 September 2014 at 16:19:41 UTC, H. S. Teoh via 
Digitalmars-d-learn wrote:
 On Thu, Sep 25, 2014 at 03:57:36PM +0000, szabo bogdan via 
 Digitalmars-d-learn wrote:
 Hi,
 
 How I can sign a request for flickrl oauth api?
 https://www.flickr.com/services/api/auth.oauth.html#request_token
 
 there is no HMAC-SHA1 algorithm in phobos library... should I 
 implement it
 from scratch?
[...] Implementing cryptographic algorithms on your own is probably not a good idea. Your safest bet is to use one of the many C authentication libraries out there, since D can call C functions directly. T
Sep 25 2014
prev sibling parent reply "John Chapman" <johnch_atms hotmail.com> writes:
 there is no HMAC-SHA1 algorithm in phobos library... should I 
 implement it from scratch?
http://dlang.org/phobos/std_digest_sha.html#SHA1
Sep 25 2014
parent reply "Adam D. Ruppe" <destructionator gmail.com> writes:
On Thursday, 25 September 2014 at 17:03:43 UTC, John Chapman 
wrote:
 http://dlang.org/phobos/std_digest_sha.html#SHA1
Not quite the same, the oauth requires hmac. When I did this in my oauth.d for twitter and stuff, I used the C library "mhash" check out my code: https://github.com/adamdruppe/arsd/blob/master/oauth.d#L796 The rest of that lib is kinda sloppy and has a few dependencies from my other modules but feel free to use whatever looks useful to you. I think mhash is GPL licensed.
Sep 25 2014
parent "szabo bogdan" <szabobogdan yahoo.com> writes:
On Thursday, 25 September 2014 at 17:09:40 UTC, Adam D. Ruppe 
wrote:
 On Thursday, 25 September 2014 at 17:03:43 UTC, John Chapman 
 wrote:
 http://dlang.org/phobos/std_digest_sha.html#SHA1
Not quite the same, the oauth requires hmac. When I did this in my oauth.d for twitter and stuff, I used the C library "mhash" check out my code: https://github.com/adamdruppe/arsd/blob/master/oauth.d#L796 The rest of that lib is kinda sloppy and has a few dependencies from my other modules but feel free to use whatever looks useful to you. I think mhash is GPL licensed.
it works! thanks!
Sep 25 2014