[Java] Implement a RSA algorithm
- by Robin Monjo
Hello everyone.
I want to implement a RSA algorithm to encrypt an image (byte[]). To generate my two keys I used this piece of code :
KeyPairGenerator keygen = KeyPairGenerator.getInstance("RSA");
keygen.initialize(512);
keyPair = keygen.generateKeyPair();
Once public and private key are generated, I would like to show them to the user so he can distribute the public key and use the private key to decode.
How can I get back those key ?
Using keygen.getPrivateKey() and keygen.getPublicKey() give me all the information of the RSA algorithm, not only the keys I need.
Thanks