RS256 JWT Format

Hello,

I am using the JWT with RSA public/private key. When I am using the public/private keys on the python side, I am able to encode and decode properly.

On ROR, i tried providing the signature_key in PEM format and also in regular public key format. in both cases, I am hitting the below.

What is the preferred format in which public needs to be specified in the JWT section.

<
Caused by: java.security.spec.InvalidKeySpecException: java.security.InvalidKeyException: IOException: DerInputStream.getLength(): lengthTag=72, too big.
at sun.security.rsa.RSAKeyFactory.engineGeneratePublic(RSAKeyFactory.java:205) ~[?:?]
at java.security.KeyFactory.generatePublic(KeyFactory.java:334) ~[?:1.8.0_172]
at tech.beshu.ror.acl.blocks.rules.impl.JwtAuthSyncRule.match(JwtAuthSyncRule.java:123) ~[?:?]
at tech.beshu.ror.acl.blocks.Block.lambda$checkAsyncRulesInSequence$4(Block.java:141) ~[?:?]
at tech.beshu.ror.utils.FuturesSequencer.runInSeqUntilConditionIsUndone(FuturesSequencer.java:52) ~[?:?]
at tech.beshu.ror.utils.FuturesSequencer.runInSeqUntilConditionIsUndone(FuturesSequencer.java:34) ~[?:?]
at tech.beshu.ror.acl.blocks.Block.checkAsyncRulesInSequence(Block.java:139) ~[?:?]
at tech.beshu.ror.acl.blocks.Block.checkAsyncRules(Block.java:129) ~[?:?]
at tech.beshu.ror.acl.blocks.Block.check(Block.java:115) ~[?:?]
at tech.beshu.ror.acl.ACL.lambda$doCheck$6(ACL.java:241) ~[?:?]
at tech.beshu.ror.utils.FuturesSequencer.runInSeqUntilConditionIsUndone(FuturesSequencer.java:52) ~[?:?]
at tech.beshu.ror.utils.FuturesSequencer.lambda$runInSeqUntilConditionIsUndone$2(FuturesSequencer.java:58) ~[?:?]
at java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:981) ~[?:1.8.0_172]
… 76 more

it should be in pem without the START/END banner, and all in one line.

Hi @ravjanga, did this solve your issue?

1 Like

Just tried the solution and it worked.

Thanks,
Ravikanth

1 Like