-
Notifications
You must be signed in to change notification settings - Fork 50
Open
Description
Hello,
I am trying to verify a JWT token using RS256 and an RSA public key. However, I keep getting "ArgumentError"
What is the correct way to pass in RSA key?
This is what I am doing:
[{_, key, _}] = "-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----\n"
|> :public_key.pem_decode
token = "__header__.__payload__.__sig__"
JsonWebToken.verify(token, %{alg: "RS256", key: key})
This is the error I get:
** (ArgumentError) argument error
(crypto) :crypto.pkey_verify_nif(:rsa, :sha256, "header.payload.sig", <<7, 49, 241, 224, ..., 85, 4, 3, 19, ...>>, [])
(crypto) crypto.erl:420: :crypto.verify/6
(json_web_token) lib/json_web_token/jws.ex:103: JsonWebToken.Jws.verified/3
(json_web_token) lib/json_web_token/jwt.ex:89: JsonWebToken.Jwt.verify/2
mmcc, vinagrito, JanaVPetrova, legomushroom and Sinacosa
Metadata
Metadata
Assignees
Labels
No labels