Here you can find the source of generateKeyPair(final String algorithm, final int keylen)
public static KeyPair generateKeyPair(final String algorithm, final int keylen) throws NoSuchAlgorithmException
//package com.java2s; //License from project: Open Source License import java.security.KeyPair; import java.security.KeyPairGenerator; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; public class Main { public static KeyPair generateKeyPair(final String algorithm, final int keylen) throws NoSuchAlgorithmException { KeyPairGenerator kpGen = KeyPairGenerator.getInstance(algorithm); SecureRandom random = SecureRandom.getInstance("SHA1PRNG"); kpGen.initialize(keylen, random); return kpGen.generateKeyPair(); }// w ww. j av a2 s .co m }