question: public static KeyPair generateKeyPair ( KeyPairType keyPairType , int keySize , Provider provider ) throws CryptoException { try { KeyPairGenerator keyPairGen = null ; if ( provider != null ) { keyPairGen = KeyPairGenerator . getInstance ( keyPairType . jce ( ) , provider ) ; } else { if ( keyPairType == RSA ) { keyPairGen = KeyPairGenerator . getInstance ( keyPairType . jce ( ) , BOUNCY_CASTLE . jce ( ) ) ; } else { keyPairGen = KeyPairGenerator . getInstance ( keyPairType . jce ( ) ) ; } } SecureRandom rand = SecureRandom . getInstance ( "SHA1PRNG" ) ; keyPairGen . initialize ( keySize , rand ) ; KeyPair keyPair = keyPairGen . generateKeyPair ( ) ; return keyPair ; } catch ( GeneralSecurityException ex ) { throw new CryptoException ( MessageFormat . format ( res . getString ( "NoGenerateKeypair.exception.message" ) , keyPairType ) , ex ) ; } }
target:  Generate a key pair.