[erlang-questions] How to encode data with private key?
Wed Jun 15 10:43:53 CEST 2016
On Wed, Jun 15, 2016 at 1:33 PM, Martin Koroudjiev
> I figured it out. The private key provided by Google contains algorithm
> and version information. It was with "-----BEGIN PRIVATE KEY-----"
> header. I had to convert it to only RSA key with "openssl rsa -in
> server.key -out server_new.key". Then I use the following to sign the data:
> [PrivEntry] = public_key:pem_decode(list_to_binary(PrivateKey)),
> Priv = public_key:pem_entry_decode(PrivEntry),
> public_key:sign(Data, sha256, Priv);
> That's how to sign Google's JSON Web Tokens. Hope this will be helpful
> to someone else.
I was about to go that path and your email saved me the effort :)
Thanks for sharing,
More information about the erlang-questions