code: public static final KeyGenerator getInstance(String algorithm,
              Provider provider) throws NoSuchAlgorithmException {
          Instance instance = JceSecurity.getInstance("KeyGenerator",
                  KeyGeneratorSpi.class, algorithm, provider);
          return new KeyGenerator((KeyGeneratorSpi)instance.impl,
                  instance.provider, algorithm);
      }
docs: Returns a <code>KeyGenerator</code> object that generates secret keys
  for the specified algorithm.
  
  <p> A new KeyGenerator object encapsulating the
  KeyGeneratorSpi implementation from the specified Provider
  object is returned.  Note that the specified Provider object
  does not have to be registered in the provider list.
  
  @param algorithm the standard name of the requested key algorithm.
  See the KeyGenerator section in the <a href=
  "{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/StandardNames.html#KeyGenerator">
  Java Cryptography Architecture Standard Algorithm Name Documentation</a>
  for information about standard algorithm names.
  
  @param provider the provider.
  
  @return the new <code>KeyGenerator</code> object.
  
  @exception NullPointerException if the specified algorithm is null.
  
  @exception NoSuchAlgorithmException if a KeyGeneratorSpi
  implementation for the specified algorithm is not available
  from the specified Provider object.
  
  @exception IllegalArgumentException if the <code>provider</code>
  is null.
  
  @see java.security.Provider