views:

1457

answers:

2

I've been able find information on symmetric encryption and hashing but I've been having quite a bit of trouble finding much information on any sort of public key encryption for java. What I'd like to do is make a very simple proof of concept program that takes a string ( or a file I suppose), encrypts it with a public key and then decrypts it with a private key.

Any tutorial links or examples would be appreciated. I just want to make something demonstrating how you can use public key encryption in Java.

A: 

There is quite a few ressources on the web about that. Basically it turns around the KeyPairGenerator class.

See http://www.informit.com/articles/article.aspx?p=170967&seqNum=4 for an example program.

Loki
For the example you gave, I got the following error: Cannot find any provider supporting RSA/NONE/PKCS1PADDING . I wonder if this computer's copy of java doesn't have it implemented.
Eugene M
Try RSA/ECB/PKCS1Padding. ECB is effectively "no" block chaining mode.
erickson
Yes, that worked. Thanks.
Eugene M
+2  A: 
erickson