code: 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();
      }
docs: Generates a key pair of given algorithm and strength.
  
  @param algorithm the algorithm of the key pair.
  @param bits the strength
  @return <code>KeyPair</code> the generated key pair.
  @exception GeneralSecurityException if something goes wrong.