How to use RSA private keys using Java
I want to use the RSA private key in开发者_运维知识库 my project using Java. I do have the key in file using PEM format. I want to use this private key into my project to decrypt the messages which are encrypted using my public key.
What is the method/standard classes I can use to read and decode the private key from the PEM file? I don't want to use the openssl or any other libraries/classes to do this. An example or sample code will be really helpful.
Vishal N
The Bouncycastle PEMReader class will do what you want. If you insist on not using the Bouncycastle library then you can simply look at the source code for the class to see how they do it.
You Might Want to go through the following links :
Stack Overflow Older Question
and
Java RSA Encryption Sample Code
精彩评论