
Returns a new Builder object.
The first call to the KeyStore.Builder.getKeyStore() method on the returned
builder will create a KeyStore of type type and call
its load() method.
The inputStream argument is constructed from
file.
If protection is a
PasswordProtection, the password is obtained by
calling the getPassword method.
Otherwise, if protection is a
CallbackHandlerProtection, the password is obtained
by invoking the CallbackHandler.
Subsequent calls to KeyStore.Builder.getKeyStore() return the same object
as the initial call. If the initial call to failed with a
KeyStoreException, subsequent calls also throw a
KeyStoreException.
The KeyStore is instantiated from provider if
non-null. Otherwise, all installed providers are searched.
Calls to getProtectionParameter()
will return a PasswordProtection
object encapsulating the password that was used to invoke the
load method.
Note that the KeyStore.Builder.getKeyStore() method is executed
within the AccessControlContext of the code invoking this
method.
Returns:
a new Builder object
Parameters:
- type - the type of KeyStore to be constructed
- provider - the provider from which the KeyStore is to
be instantiated (or null)
- file - the File that contains the KeyStore data
- protection - the ProtectionParameter securing the KeyStore data
Throws:
- NullPointerException - if type, file or protection is null
- IllegalArgumentException - if protection is not an instance
of either PasswordProtection or CallbackHandlerProtection; or
if file does not exist or does not refer to a normal file