Skip to content

Most visited

Recently visited

navigation
Added in API level 1

KeyStore.Builder

public static abstract class KeyStore.Builder
extends Object

java.lang.Object
   ↳ java.security.KeyStore.Builder


Builder is used to construct new instances of KeyStore.

Summary

Protected constructors

KeyStore.Builder()

Constructs a new instance of Builder.

Public methods

abstract KeyStore getKeyStore()

Returns the KeyStore created by this Builder.

abstract KeyStore.ProtectionParameter getProtectionParameter(String alias)

Returns the ProtectionParameter to be used when a Entry with the specified alias is requested.

static KeyStore.Builder newInstance(KeyStore keyStore, KeyStore.ProtectionParameter protectionParameter)

Returns a new Builder that holds the given KeyStore and the given ProtectionParameter.

static KeyStore.Builder newInstance(String type, Provider provider, KeyStore.ProtectionParameter protectionParameter)

Returns a new Builder that creates a new KeyStore based on the provided arguments.

static KeyStore.Builder newInstance(String type, Provider provider, File file, KeyStore.ProtectionParameter protectionParameter)

Returns a new Builder that creates a new KeyStore based on the provided arguments.

Inherited methods

From class java.lang.Object

Protected constructors

KeyStore.Builder

Added in API level 1
KeyStore.Builder ()

Constructs a new instance of Builder.

Public methods

getKeyStore

Added in API level 1
KeyStore getKeyStore ()

Returns the KeyStore created by this Builder.

Returns
KeyStore the KeyStore created by this Builder.
Throws
KeyStoreException if an error occurred during construction.

getProtectionParameter

Added in API level 1
KeyStore.ProtectionParameter getProtectionParameter (String alias)

Returns the ProtectionParameter to be used when a Entry with the specified alias is requested. Before this method is invoked, getKeyStore() must be called.

Parameters
alias String: the alias for the entry.
Returns
KeyStore.ProtectionParameter the ProtectionParameter to be used when a Entry with the specified alias is requested.
Throws
KeyStoreException if an error occurred during the lookup for the protection parameter.
IllegalStateException if getKeyStore() is not called prior the invocation of this method.
NullPointerException if alias is null.

newInstance

Added in API level 1
KeyStore.Builder newInstance (KeyStore keyStore, 
                KeyStore.ProtectionParameter protectionParameter)

Returns a new Builder that holds the given KeyStore and the given ProtectionParameter.

Parameters
keyStore KeyStore: the KeyStore to be held.
protectionParameter KeyStore.ProtectionParameter: the ProtectionParameter to be held.
Returns
KeyStore.Builder a new instance of Builder that holds the specified KeyStore and the specified ProtectionParameter.
Throws
NullPointerException if keyStore or protectionParameter is null.
IllegalArgumentException if the given KeyStore is not initialized.

newInstance

Added in API level 1
KeyStore.Builder newInstance (String type, 
                Provider provider, 
                KeyStore.ProtectionParameter protectionParameter)

Returns a new Builder that creates a new KeyStore based on the provided arguments.

If provider is null, all installed providers are searched, otherwise the key store from the specified provider is used.

Parameters
type String: the type of the KeyStore to be constructed.
provider Provider: the provider of the KeyStore to be constructed, maybe null.
protectionParameter KeyStore.ProtectionParameter: the ProtectionParameter used to protect the stored keys.
Returns
KeyStore.Builder a new Builder that creates a new KeyStore based on the provided arguments.
Throws
NullPointerException if type or protectionParameter is null.
IllegalArgumentException protectionParameter not an instance of either PasswordProtection or CallbackHandlerProtection, file is not a file or does not exist at all.

newInstance

Added in API level 1
KeyStore.Builder newInstance (String type, 
                Provider provider, 
                File file, 
                KeyStore.ProtectionParameter protectionParameter)

Returns a new Builder that creates a new KeyStore based on the provided arguments.

If provider is null, all installed providers are searched, otherwise the key store from the specified provider is used.

Parameters
type String: the type of the KeyStore to be constructed.
provider Provider: the provider of the KeyStore to be constructed, maybe null.
file File: the File that contains the data for the KeyStore.
protectionParameter KeyStore.ProtectionParameter: the ProtectionParameter used to protect the stored keys.
Returns
KeyStore.Builder a new Builder that creates a new KeyStore based on the provided arguments.
Throws
NullPointerException if type, protectionParameter or file is null.
IllegalArgumentException protectionParameter not an instance of either PasswordProtection or CallbackHandlerProtection, file is not a file or does not exist at all.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.