code: public static KeyStore getInstance(String type, String provider)
          throws KeyStoreException, NoSuchProviderException
      {
          if (provider == null || provider.length() == 0)
              throw new IllegalArgumentException("missing provider");
          try {
              Object[] objs = Security.getImpl(type, "KeyStore", provider);
              return new KeyStore((KeyStoreSpi)objs[0], (Provider)objs[1], type);
          } catch (NoSuchAlgorithmException nsae) {
              throw new KeyStoreException(type + " not found", nsae);
          }
      }
docs: Returns a keystore object of the specified type.
  
  <p> A new KeyStore object encapsulating the
  KeyStoreSpi implementation from the specified provider
  is returned.  The specified provider must be registered
  in the security provider list.
  
  <p> Note that the list of registered providers may be retrieved via
  the {@link Security#getProviders() Security.getProviders()} method.
  
  @param type the type of keystore.
  See the KeyStore section in the <a href=
  "{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/StandardNames.html#KeyStore">
  Java Cryptography Architecture Standard Algorithm Name Documentation</a>
  for information about standard keystore types.
  
  @param provider the name of the provider.
  
  @return a keystore object of the specified type.
  
  @exception KeyStoreException if a KeyStoreSpi
  implementation for the specified type is not
  available from the specified provider.
  
  @exception NoSuchProviderException if the specified provider is not
  registered in the security provider list.
  
  @exception IllegalArgumentException if the provider name is null
  or empty.
  
  @see Provider