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?
Asked
Active
Viewed 532 times
0

Randi
- 639
- 2
- 6
- 23
-
2providing 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 Answers
0
Java doesn't support .pem
files natively. See this issue.
See how to read .pem
files in Java.

Sabito stands with Ukraine
- 4,271
- 8
- 34
- 56

Tsiyona Dershowitz
- 77
- 2
- 8
-
Good find, but you should flag as duplicate instead of linking there. – Yunnosch Dec 07 '20 at 14:16