I try to implement VAPID Claim, that use ECDH signature with prime256v1 curve.
Here the code:
test() ->
Msg = <<"test">>,
{PubKey, PrivKey} = crypto:generate_key(ecdh, prime256v1),
?LOG(notice,"PubKey:~p~n",[PubKey]),
?LOG(notice," PrivKey:~p~n",[PrivKey]),
Signature = crypto:sign(ecdsa,sha256,Msg,PrivKey),
?LOG(notice,"~p~n",[Signature]).
When I run it, I got error message:
** exception error: {badarg,{"pkey.c",363},"Couldn't get ECDSA private key"}
in function crypto:sign/5 (crypto.erl, line 1455)
*** argument 4: Couldn't get ECDSA private key
*** (Found in the internal file pkey.c at line 363)
Any idea how to fix it?
Found solution in enter link description here
Should be