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.
- Export key with
"-----BEGIN PRIVATE KEY-----\n"+Base64.getEncoder().encodeToString(rsaJsonWebKey.getRsaPrivateKey()).replaceAll("(.{64})", "$1\n")+"\n-----END PRIVATE KEY-----"
- Repeat for Public Key (with “PUBLIC KEY” stanza)
- Don’t forget to change Algorithm in jwt.io
- Paste both keys to appropriate fields.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.