FusionAuth
    • Home
    • Categories
    • Recent
    • Popular
    • Pricing
    • Contact us
    • Docs
    • Login

    Verification of ID Token using RSA public key

    Scheduled Pinned Locked Moved
    General Discussion
    rsa jwks verification validation client-library
    2
    2
    3.5k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • G
      gokul.mahajan20
      last edited by gokul.mahajan20

      Hey All
      Just wondering if I am doing something wrong here. I am using FusionAuth java library https://github.com/FusionAuth/fusionauth-jwt.

      Java Code :

          ```List<JSONWebKey> keys = JSONWebKeySetHelper.retrieveKeysFromJWKS("http://localhost:9011/.well-known/jwks.json");
          Map<String, Verifier> publicKeyVerifiers = new HashMap<String,Verifier>();
          for (JSONWebKey key : keys) {
              String publicKey = key.x5c.get(0);
              Verifier verifier = RSAVerifier.newVerifier(publicKey); 
              String kid = key.kid;
              publicKeyVerifiers.put(kid, verifier);
          }```
      

      Exception I am getting :
      InvalidParameterException : Unexpected PEM Format

      I think the problem here is that if we look at the "key.x5c" from jwks.json, it does not start with "-----BEGIN" and hence it is throwing above exception.
      The FusionAuth library class io.fusionauth.pem.PEMDecoder expect "-----BEGIN" which does not exist.
      Screenshot of jwks.json

      90cedaa7-e260-4ea5-8a51-1f58fb3a9976-image.png

      danD 1 Reply Last reply Reply Quote 0
      • danD
        dan @gokul.mahajan20
        last edited by

        @gokul-mahajan20

        Can you add ----BEGIN to the JWKS certs?

        --
        FusionAuth - Auth for devs, built by devs.
        https://fusionauth.io

        1 Reply Last reply Reply Quote 0
        • First post
          Last post