Here you can find the source of generateRSA(int keySize)
public static KeyPair generateRSA(int keySize) throws NoSuchAlgorithmException, NoSuchProviderException
//package com.java2s; /************************************************************************* * * * SignServer: The OpenSource Automated Signing Server * * * * This software is free software; you can redistribute it and/or * * modify it under the terms of the GNU Lesser General Public * * License as published by the Free Software Foundation; either * * version 2.1 of the License, or any later version. * * * * See terms of license at gnu.org. * * * *************************************************************************/ import java.security.*; public class Main { public static KeyPair generateRSA(int keySize) throws NoSuchAlgorithmException, NoSuchProviderException { KeyPairGenerator g = KeyPairGenerator.getInstance("RSA", "BC"); g.initialize(keySize, new SecureRandom()); return g.generateKeyPair(); }// ww w . ja va2 s .co m }