Here you can find the source of generateRSAKeyPair()
private static KeyPair generateRSAKeyPair()
//package com.java2s; //License from project: Apache License import java.security.KeyPair; import java.security.KeyPairGenerator; public class Main { private static KeyPair generateRSAKeyPair() { try {/*ww w. j av a2 s.co m*/ KeyPairGenerator keyGenerator = KeyPairGenerator.getInstance("RSA"); keyGenerator.initialize(1024); return keyGenerator.genKeyPair(); } catch (Exception ex) { return null; } } }