public static KeyPair generateKeyPair ( final int keyLen ) throws NoSuchAlgorithmException { final String name = ASYM_CIPHER_CHAIN_PADDING ; final int offset = name . indexOf ( ' ' ) ; final String alg = ( ( offset < 0 ) ? name : name . substring ( 0 , offset ) ) ; final KeyPairGenerator generator = KeyPairGenerator . getInstance ( alg ) ; generator . initialize ( keyLen ) ; return generator . genKeyPair ( ) ; }
Generate RSA KeyPair