It seems that my problem is exactly as described here: Verifying JWT signed with the RS256 algorithm using public key in C# But, I fail to understand the reply. Hoping somebody can help.
my c# code gets from external server token and key (in json file). after extract them, I can read the token but must verify that key is valid. How can I verify the key?
in the example above, Dmitry writes that he has token and key, but in the solution I don't find using the key...
That is my code:
public JwtSecurityToken getUnsignedProperies(string signedUserProperties)
{
string json;
try
{
JsonSerializer serializer = new JsonSerializer();
JObject jsonNode = JObject.Parse(signedUserProperties);
if (jsonNode["error"] != null)
{
throw new Exception(jsonNode["error"].ToString());
}
key= jsonNode["publicKey"].ToString();
string signature = jsonNode["token"].ToString();
JwtSecurityToken token = new JwtSecurityToken(signature);
return token;
---
and I have to verify the key, before return it...
Thanks!