code: public static SshKeyPair generateKeyPair(String algorithm, int bits)
  			throws IOException, SshException {
  
  		if (!SSH2_RSA.equalsIgnoreCase(algorithm)
  				&& !SSH2_DSA.equalsIgnoreCase(algorithm)) {
  			throw new IOException(algorithm
  					+ " is not a supported key algorithm!");
  		}
  
  		SshKeyPair pair = new SshKeyPair();
  
  		if (SSH2_RSA.equalsIgnoreCase(algorithm)) {
  			pair = ComponentManager.getInstance().generateRsaKeyPair(bits);
  		} else {
  			pair = ComponentManager.getInstance().generateDsaKeyPair(bits);
  		}
  
  		return pair;
  	}
docs: Generates a new key pair.
  
  @param algorithm
  @param bits
  @return SshKeyPair
  @throws IOException