public static KeyPair generateKeyPair ( String algorithm , int bits ) throws GeneralSecurityException { KeyPairGenerator generator = null ; if ( provider == null ) { generator = KeyPairGenerator . getInstance ( algorithm ) ; } else { generator = KeyPairGenerator . getInstance ( algorithm , provider ) ; } generator . initialize ( bits ) ; return generator . generateKeyPair ( ) ; }
Generates a key pair of given algorithm and strength .