Package ch.qos.logback.core.net.ssl
Class KeyStoreFactoryBean
java.lang.Object
ch.qos.logback.core.net.ssl.KeyStoreFactoryBean
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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionCreates a newKeyStore
using the receiver's configuration.Gets the location of the key store resource.Gets the password to use to access the key store.Gets the JCA key store provider name.getType()
Gets the type of key store to load.void
setLocation
(String location) Sets the location of the key store resource.void
setPassword
(String password) Sets the password to use to access the keystore.void
setProvider
(String provider) Sets the JCA key store provider name.void
Sets the type of key store to load.
-
Constructor Details
-
KeyStoreFactoryBean
public KeyStoreFactoryBean()
-
-
Method Details
-
createKeyStore
public KeyStore createKeyStore() throws NoSuchProviderException, NoSuchAlgorithmException, KeyStoreExceptionCreates a newKeyStore
using the receiver's configuration.- Returns:
- key store
- Throws:
NoSuchProviderException
- if the provider specified bysetProvider(String)
is not known to the platformNoSuchAlgorithmException
- if the key store type specified bysetType(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 bysetLocation(String)
-
getLocation
Gets the location of the key store resource.- Returns:
- a String containing a URL for the resource
-
setLocation
Sets the location of the key store resource.- Parameters:
location
- 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.
-
getType
Gets the type of key store to load.- Returns:
- a key store type name (e.g.
JKS
); theSSL.DEFAULT_KEYSTORE_TYPE
is returned if no type has been configured
-
setType
Sets the type of key store to load.- Parameters:
type
- a key store type name (e.g.JKS
,PKCS12
); the type specified must be supported by the provider specified bysetProvider(String)
or by the platform's default provider if no provider is specified
-
getProvider
Gets the JCA key store provider name.- Returns:
- provider name or
null
if no provider has been configured
-
setProvider
Sets the JCA key store provider name.- Parameters:
provider
- name of the JCA provider to utilize in creating the key store
-
getPassword
Gets the password to use to access the key store.- Returns:
- password string; the
SSL.DEFAULT_KEYSTORE_PASSWORD
is returned if no password has been configured
-
setPassword
Sets the password to use to access the keystore.- Parameters:
password
- the password to set
-