[erlang-questions] crypto:sha_mac correct invcation

Bob Ippolito bob@REDACTED
Thu Dec 2 11:57:42 CET 2010


It should be invoked with the crypto application running.

application:start(crypto).

On Thu, Dec 2, 2010 at 5:52 PM, Paolo Negri <paolo.negri@REDACTED> wrote:
> Hi everyone
>
> Sorry for the newbie question, I'm trying to understand how
> crypto:sha_mac/2 should be invoked
>
> Key = "my_key".
> Data = "GET\n\n\nThu, 02 Dec 2010 10:05:01 GMT\n/".
>
> crypto:sha_mac(Key, Data).
> ** exception error: bad argument
>     in function  port_control/3
>        called as port_control(crypto_drv02,11,
>                               [<<0,0,0,6>>,
>                                "my_key","GET\n\n\nThu, 02 Dec 2010
> 10:05:01 GMT\n/"])
>
> This is an extraction from a library I'm trying to use
> https://github.com/Voker57/s3erl
>
> and it breaks because internally it executes such a call to crypto:sha_mac
>
> I've tried on Erlang R13B03 (erts-5.7.4) installed with apt-get on
> ubuntu 10.04 and on Erlang R13B04 (erts-5.7.5) compiled from source
> always on ubuntu 10.04
>
> I read http://www.erlang.org/doc/man/crypto.html#sha_mac-2 and tried
> converting the list to binary but I didn't manage to make it work.
>
> crypto:sha_mac(list_to_binary("my_key"),list_to_binary("GET\n\n\nThu,
> 02 Dec 2010 10:05:01 GMT\n/")).
> ** exception error: bad argument
>     in function  port_control/3
>        called as port_control(crypto_drv02,11,
>                               [<<0,0,0,6>>,
>                                <<"my_key">>,
>                                <<"GET\n\n\nThu, 02 Dec 2010 10:05:01
> GMT\n/">>])
>
> Thanks for your help.
>
> Paolo
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
>
>


More information about the erlang-questions mailing list