Get public/private keys from jose4j for check JWT in jwt.io

I’m debugging some JWT stuff and have generated key with RsaJwkGenerator.generateJwk(2048). I successfully export/import keys to json file.
Now I need to export private key in some usefull format to check JWT on jwt.io (and use in other apps).
Any ideas how to export private key?

Ok, found the solution.

  1. Export key with "-----BEGIN PRIVATE KEY-----\n"+Base64.getEncoder().encodeToString(rsaJsonWebKey.getRsaPrivateKey()).replaceAll("(.{64})", "$1\n")+"\n-----END PRIVATE KEY-----"
  2. Repeat for Public Key (with “PUBLIC KEY” stanza)
  3. Don’t forget to change Algorithm in jwt.io
  4. Paste both keys to appropriate fields.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.