Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to construct Public key #371

Closed
shebinhere opened this issue Dec 28, 2019 · 1 comment
Closed

Unable to construct Public key #371

shebinhere opened this issue Dec 28, 2019 · 1 comment

Comments

@shebinhere
Copy link

I am unable to construct the Public key from .pem file. I need public key to verify the JWT token.
Here is how i am trying.

image

Downloaded the .pem file from link - https://{instance}.auth0.com/dbconnections/pem

And the error i am getting,

java.security.spec.InvalidKeySpecException: java.security.InvalidKeyException: IOException: ObjectIdentifier() – data isn’t an object ID (tag = -96)
at sun.security.rsa.RSAKeyFactory.engineGeneratePublic(RSAKeyFactory.java:205)
at java.security.KeyFactory.generatePublic(KeyFactory.java:334)
at com.ceino.supportapp.test.JWTClass.getPublicKey(JWTClass.java:93)
at com.ceino.supportapp.test.JWTClass.readPublicKeyFromFile(JWTClass.java:106)
at com.ceino.supportapp.test.JWTClass.main(JWTClass.java:35)
Caused by: java.security.InvalidKeyException: IOException: ObjectIdentifier() – data isn’t an object ID (tag = -96)
at sun.security.x509.X509Key.decode(X509Key.java:397)
at sun.security.x509.X509Key.decode(X509Key.java:402)
at sun.security.rsa.RSAPublicKeyImpl.(RSAPublicKeyImpl.java:86)
at sun.security.rsa.RSAKeyFactory.generatePublic(RSAKeyFactory.java:298)
at sun.security.rsa.RSAKeyFactory.engineGeneratePublic(RSAKeyFactory.java:201)
… 4 more
@lbalmaceda
Copy link
Contributor

Creating new or reading existing keys is not part of this library's responsibilities. I saw Ashish replied to you on the community suggesting the use of jwks-rsa-java for fetching the public keys. Have you tried that?

https://community.auth0.com/t/verify-jwt-token-received-from-auth0/35581/4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants