Top Description Fields Constructors Methods
ch.qos.logback.core.net.ssl

public Class KeyStoreFactoryBean

extends Object
Class Inheritance
Imports
java.io.FileNotFoundException, .IOException, .InputStream, java.net.URL, java.security.KeyStore, .KeyStoreException, .NoSuchAlgorithmException, .NoSuchProviderException, ch.qos.logback.core.util.LocationUtil

A factory bean for a JCA KeyStore.

This object holds the configurable properties of a key store and uses them to create and load a KeyStore instance.

Author
Carl Harris

Field Summary

Modifier and TypeField and Description
private String
private String
private String
private String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public KeyStore

Returns:

key store
createKeyStore
()

Creates a new KeyStore using the receiver's configuration.

public String

Returns:

a String containing a URL for the resource
getLocation
()

Gets the location of the key store resource.

public String

Returns:

password string; the SSL#DEFAULT_KEYSTORE_PASSWORD is returned if no password has been configured
getPassword
()

Gets the password to use to access the key store.

public String

Returns:

provider name or null if no provider has been configured
getProvider
()

Gets the JCA key store provider name.

public String

Returns:

a key store type name (e.g. JKS); the SSL#DEFAULT_KEYSTORE_TYPE is returned if no type has been configured
getType
()

Gets the type of key store to load.

private KeyStore
newKeyStore()

Invokes the appropriate JCE factory method to obtain a new KeyStore object.

public void
setLocation(String
a String containing a URL for the resource; if the URL string isn't prefixed by a scheme, the path is assumed to be relative to the root of the classpath.
location
)

Sets the location of the key store resource.

public void
setPassword(String
the password to set
password
)

Sets the password to use to access the keystore.

public void
setProvider(String
name of the JCA provider to utilize in creating the key store
provider
)

Sets the JCA key store provider name.

public void
setType(String
a key store type name (e.g. JKS, PKCS12); the type specified must be supported by the provider specified by setProvider(String) or by the platform's default provider if no provider is specified
type
)

Sets the type of key store to load.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

locationback to summary
private String location
passwordback to summary
private String password
providerback to summary
private String provider
typeback to summary
private String type

Constructor Detail

KeyStoreFactoryBeanback to summary
public KeyStoreFactoryBean()

Method Detail

createKeyStoreback to summary
public KeyStore createKeyStore() throws NoSuchProviderException, NoSuchAlgorithmException, KeyStoreException

Creates a new KeyStore using the receiver's configuration.

Returns:KeyStore

key store

Exceptions
NoSuchProviderException:
if the provider specified by setProvider(String) is not known to the platform
NoSuchAlgorithmException:
if the key store type specified by setType(String) is not known to the specified provider (or the platform's default provider if the provider isn't specified)
KeyStoreException:
if some other error occurs in loading the key store from the resource specified by setLocation(String)
getLocationback to summary
public String getLocation()

Gets the location of the key store resource.

Returns:String

a String containing a URL for the resource

getPasswordback to summary
public String getPassword()

Gets the password to use to access the key store.

Returns:String

password string; the SSL#DEFAULT_KEYSTORE_PASSWORD is returned if no password has been configured

getProviderback to summary
public String getProvider()

Gets the JCA key store provider name.

Returns:String

provider name or null if no provider has been configured

getTypeback to summary
public String getType()

Gets the type of key store to load.

Returns:String

a key store type name (e.g. JKS); the SSL#DEFAULT_KEYSTORE_TYPE is returned if no type has been configured

newKeyStoreback to summary
private KeyStore newKeyStore() throws NoSuchAlgorithmException, NoSuchProviderException, KeyStoreException

Invokes the appropriate JCE factory method to obtain a new KeyStore object.

setLocationback to summary
public void setLocation(String location)

Sets the location of the key store resource.

Parameters
location:String

a String containing a URL for the resource; if the URL string isn't prefixed by a scheme, the path is assumed to be relative to the root of the classpath.

setPasswordback to summary
public void setPassword(String password)

Sets the password to use to access the keystore.

Parameters
password:String

the password to set

setProviderback to summary
public void setProvider(String provider)

Sets the JCA key store provider name.

Parameters
provider:String

name of the JCA provider to utilize in creating the key store

setTypeback to summary
public void setType(String type)

Sets the type of key store to load.

Parameters
type:String

a key store type name (e.g. JKS, PKCS12); the type specified must be supported by the provider specified by setProvider(String) or by the platform's default provider if no provider is specified