How to convert base64 encoded verification key to EC (ES256) public key

300 Views Asked by At

I am trying to get public key for ES256 from base64 encoded key in C#. In java below code works

// base64OfEncodedVerificationKey is provided through Play Console.
var encodedVerificationKey: ByteArray =
    Base64.decode(base64OfEncodedVerificationKey, Base64.DEFAULT)

// Deserialized verification (public) key.
var verificationKey: PublicKey = KeyFactory.getInstance(EC_KEY_TYPE)
    .generatePublic(X509EncodedKeySpec(encodedVerificationKey))

Can any one help me how to get this in C#? In C# I am using jose-jwt lib. Thanks in advance.

0

There are 0 best solutions below