title: Decode IdToken using JJWT with RSA
body: <p>My customer sends to me a JWT, I need to validate this JWT using their public key.
  I am using Java and JJWT framework to validate this token.
  I know decode this token using HS256, but using RS256 I don't know.</p>
  
  <p>their configurations is:</p>
  
  <p><a href="https://i.stack.imgur.com/9Qnah.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9Qnah.png" alt="enter image description here"></a></p>
  
  <p>Editing here to improve my question.
  The jjwt example of parse that I am using:</p>
  
  <pre><code>        Claims String secret = "-----BEGIN CERTIFICATE-----myx5ckey-----END CERTIFICATE-----"
      byte[] dataBytes = Base64.getEncoder().encode(secret.getBytes());
      byte[] byteKey = Base64.getDecoder().decode(dataBytes);
      X509EncodedKeySpec X509publicKey = new X509EncodedKeySpec(byteKey);
      KeyFactory kf = KeyFactory.getInstance("RSA");
  
      PublicKey publicKey = kf.generatePublic(X509publicKey);
  
      Claims body = null;
      body = Jwts.parser().setSigningKey(publicKey.getEncoded())
              .parseClaimsJws(idToken)
              .getBody();
  
  
  java.security.spec.InvalidKeySpecException: java.security.InvalidKeyException: invalid key format
  
      at sun.security.rsa.RSAKeyFactory.engineGeneratePublic(RSAKeyFactory.java:205)
  </code></pre>
  
  <p>How can I validate the received token using the JWKS informations that I show? (imagem above)</p>