We can use the normal java way to generate RSA key. (for security reason, we’d betterĀ generate 2048 bytes RSA key)
But the problem is the most popular way to store RSA key is keeping them as DER format.
You can get some detailed info below:
http://www.cryptosys.net/pki/rsakeyformats.html
Also if you want the java code to generate the RSA key in DER format and encrypt data using such keys. Please contact me. (ukoom AT gmail.com)