private KeyPair createKeyPair ( ) throws NoSuchAlgorithmException { final KeyPairGenerator keyGen = KeyPairGenerator . getInstance ( "RSA" ) ; final SecureRandom random = SecureRandom . getInstance ( "SHA1PRNG" ) ; random . setSeed ( Long . toString ( System . currentTimeMillis ( ) ) . getBytes ( ) ) ; keyGen . initialize ( 2048 , random ) ; final KeyPair keypair = keyGen . generateKeyPair ( ) ; return keypair ; }
Generates a 2048 bit RSA key pair using SHA1PRNG .