Auth0 Home Blog Docs

Jwt token validation using ECDSA in .net

I’m looking for a C# code sample that shows how to validate JWT token that has been created with ES256 against its corresponding public key pem.

I am trying to load the public key with below code but could not able to find the ECParameters class in System.Security.Cryptography assembly. Please help me out on this.

var pubKeyX = key.Skip(1).Take(32).ToArray();
var pubKeyY = key.Skip(33).ToArray();

        return ECDsa.Create(new ECParameters
        {
            Curve = ECCurve.NamedCurves.nistP256,
            Q = new ECPoint
            {
                X = pubKeyX,
                Y = pubKeyY
            }
        });