0

I have JJWT library integrated java project. And now I have a .PEM file which includes my RSA private key. How can I read the .PEM file and get the private key using JJWT library?

Randi
  • 639
  • 2
  • 6
  • 23
  • 2
    providing a sample of your code and more information, you will get better answers to your question. I highly recommend reading [How to ask](https://stackoverflow.com/help/how-to-ask) to improve the quality of answers you receive. – Dushyant Tankariya Jun 26 '19 at 06:27
  • there is a method `Jwtbuilder::signWith(Key)`. Just search SO on how to read private key from file and pass this key to this method... – Michał Krzywański Jun 26 '19 at 06:44
  • Have a look at this [Generating a JWT using an existing private key and RS256 algorithm](https://stackoverflow.com/a/52464921/418693). The linked answer solved the issue for me. – Arman Feb 18 '20 at 19:10

1 Answers1

0

Java doesn't support .pem files natively. See this issue.

See how to read .pem files in Java.