java.lang.Objectjava.security.KeyStore.Builder
A description of a to-be-instantiated KeyStore object.
An instance of this class encapsulates the information needed to instantiate and initialize a KeyStore object. That process is triggered when the getKeyStore() method is called.
This makes it possible to decouple configuration from KeyStore object creation and e.g. delay a password prompt until it is actually needed.
| Constructor Summary | |
|---|---|
KeyStore.Builder(String type)
Construct a Builder for a KeyStore with the specified type. |
|
| Method Summary | |
|---|---|
KeyStore |
getKeyStore()
Instantiate, load, and return the KeyStore described by this builder. |
KeyStore.ProtectionParameter |
getProtectionParameter(String alias)
Return the ProtectionParameter that should be used to obtain the Entry with the given alias. |
void |
setCallbackHandler(CallbackHandler callbackHandler)
Set the CallbackHandler that should be used to obtain the password to load the KeyStore. |
void |
setInputStream(InputStream inputStream)
Set the InputStream that the KeyStore is to be loaded from. |
void |
setLoadStoreParameter(KeyStore.LoadStoreParameter loadStoreParameter)
Set the InputStream that the KeyStore is to be loaded from. |
void |
setPassword(char[] password)
Set the password that should be used to load the KeyStore. |
void |
setProvider(Provider provider)
Set the provider object that the KeyStore is to be instantiated from. |
void |
setProvider(String providerName)
Set the name of the provider the KeyStore is to be instantiated from. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public KeyStore.Builder(String type)
The current AccessControlContext is saved for use by the
getKeyStore() method.
NullPointerException - if type is null| Method Detail |
|---|
public void setProvider(String providerName)
setProvider(Provider).
providerName - the name of the security provider (or null)public void setProvider(Provider provider)
This setting overrides a previous setting made using
setProvider(String).
provider - the security provider (or null)public void setPassword(char[] password)
Note that the password is cloned to protect against subsequent modification.
password - the password to use to load the KeyStore (or null)public void setCallbackHandler(CallbackHandler callbackHandler)
auth.login.defaultCallbackHandler security property
is queried for the fully qualified class name of a default handler
implementation.
callbackHandler - the CallbackHandler that should be used
to obtain the password (or null)public void setInputStream(InputStream inputStream)
KeyStore.load() method will be called with a value of null
as the InputStream.
This setting overrides a previous setting made using
setLoadStoreParameter().
inputStream - the inputStream to use to load the KeyStore
(or null)public void setLoadStoreParameter(KeyStore.LoadStoreParameter loadStoreParameter)
KeyStore.load() method will be called with a value of null
as the InputStream.
This setting overrides a previous setting made using
setInputStream().
loadStoreParameter - the LoadStoreParameter to use to load
the KeyStore (or null)
public KeyStore getKeyStore()
throws KeyStoreException
KeyStoreException - if the KeyStore could not be
instantiated or loadedpublic KeyStore.ProtectionParameter getProtectionParameter(String alias)
Entry with the given alias.
alias - the alias of the KeyStore entry
Entry with the given alias.
NullPointerException - if alias is null