File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Security and the fly likes Need help on genarate public key,private key to test PGP encryption & decryption on windows system Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » Security
Bookmark "Need help on genarate public key,private key to test PGP encryption & decryption on windows system" Watch "Need help on genarate public key,private key to test PGP encryption & decryption on windows system" New topic
Author

Need help on genarate public key,private key to test PGP encryption & decryption on windows system

ChakraPani Margani
Greenhorn

Joined: Aug 19, 2007
Posts: 17
Hi,
I have some java code to encrypt a file using some public key. I have public key file. File encrypted successfully. Now I want to decrypt the encrypted file to get the original file. For that one I need private key & password. I don't have private key & password. I am using PGP encryption algorithim. Please guide me how to genarate public key file & private key file & password. So that I can test the code with one file encryption & decryption in my side. I am spending lot of time on the net. Bit difficult for me to understand all those.

Please help me on this.


Thanks in advance.


Regards,
ChakraPani.
David A Morris
Greenhorn

Joined: May 09, 2012
Posts: 3
You indicated you have a public key.
Is this your own key or is this someone elses who you intend to send the encrypted file to?

I assume it must be someone elses because if it was your own key you should already know the password and be able to generate the private key for it using PGP desktop or numerous free utilities to generate key pairs.

If my assumption is right, the easiest way to test your routine is to encrypt the file to TWO public keys. The public key of the person you intend to send the file to as well as your own public key. This way, you will both be able to decrypt the file.

You are probably already using encryptedDataGenerator.addMethod(PGPPublicKey) to add the public key you have.

Just do this a second time with your own key as well.

Then the file will be encrypted to both keys allowing both people to decrypt it.

ChakraPani Margani
Greenhorn

Joined: Aug 19, 2007
Posts: 17
Thanks for your reply.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need help on genarate public key,private key to test PGP encryption & decryption on windows system