Package org.ldaptive.ssl
Class KeyStoreSSLContextInitializer
java.lang.Object
org.ldaptive.ssl.AbstractSSLContextInitializer
org.ldaptive.ssl.KeyStoreSSLContextInitializer
- All Implemented Interfaces:
SSLContextInitializer
Provides an SSL context initializer which can use java KeyStores to create key and trust managers.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate String[]
Aliases of key entries to use.private KeyStore
KeyStore used to create key managers.private char[]
Password used to access the authentication keystore.private String[]
Aliases of trust entries to use.private KeyStore
KeyStore used to create trust managers.Fields inherited from class org.ldaptive.ssl.AbstractSSLContextInitializer
logger, trustManagers
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected TrustManager[]
Creates any trust managers specific to this context initializer.String[]
Returns the aliases of the entries to use in the authentication keystoreReturns the keystore to use for creating the key managers.char[]
Returns the password used for accessing the authentication keystore.protected KeyManagerFactory
getKeyManagerFactory
(KeyStore keystore, char[] password, String... aliases) Creates a new key manager factory.Returns the key managers used when creating SSL contexts.String[]
Returns the aliases of the entries to use in the trust keystoreReturns the keystore to use for creating the trust managers.protected TrustManagerFactory
getTrustManagerFactory
(KeyStore keystore, String... aliases) Creates a new trust manager factory.void
setAuthenticationAliases
(String... aliases) Sets the aliases of the entries to use in the authentication keystore.void
setAuthenticationKeystore
(KeyStore keystore) Sets the keystore to use for creating the key managers.void
setAuthenticationPassword
(char[] password) Sets the password used for accessing the authentication keystore.void
setTrustAliases
(String... aliases) Sets the aliases of the entries to use in the trust keystore.void
setTrustKeystore
(KeyStore keystore) Sets the keystore to use for creating the trust managers.toString()
Methods inherited from class org.ldaptive.ssl.AbstractSSLContextInitializer
aggregateTrustManagers, getTrustManagers, initSSLContext, setTrustManagers
-
Field Details
-
trustKeystore
KeyStore used to create trust managers. -
trustAliases
Aliases of trust entries to use. -
authenticationKeystore
KeyStore used to create key managers. -
authenticationAliases
Aliases of key entries to use. -
authenticationPassword
private char[] authenticationPasswordPassword used to access the authentication keystore.
-
-
Constructor Details
-
KeyStoreSSLContextInitializer
public KeyStoreSSLContextInitializer()
-
-
Method Details
-
getTrustKeystore
Returns the keystore to use for creating the trust managers.- Returns:
- keystore
-
setTrustKeystore
Sets the keystore to use for creating the trust managers.- Parameters:
keystore
- to set
-
getTrustAliases
Returns the aliases of the entries to use in the trust keystore- Returns:
- trust aliases
-
setTrustAliases
Sets the aliases of the entries to use in the trust keystore.- Parameters:
aliases
- to use
-
getAuthenticationKeystore
Returns the keystore to use for creating the key managers.- Returns:
- keystore
-
setAuthenticationKeystore
Sets the keystore to use for creating the key managers.- Parameters:
keystore
- to set
-
getAuthenticationAliases
Returns the aliases of the entries to use in the authentication keystore- Returns:
- authentication aliases
-
setAuthenticationAliases
Sets the aliases of the entries to use in the authentication keystore.- Parameters:
aliases
- to use
-
getAuthenticationPassword
public char[] getAuthenticationPassword()Returns the password used for accessing the authentication keystore.- Returns:
- authentication password
-
setAuthenticationPassword
public void setAuthenticationPassword(char[] password) Sets the password used for accessing the authentication keystore.- Parameters:
password
- to use for authentication
-
createTrustManagers
Description copied from class:AbstractSSLContextInitializer
Creates any trust managers specific to this context initializer.- Specified by:
createTrustManagers
in classAbstractSSLContextInitializer
- Returns:
- trust managers
- Throws:
GeneralSecurityException
- if an errors occurs while loading the TrustManagers
-
getTrustManagerFactory
protected TrustManagerFactory getTrustManagerFactory(KeyStore keystore, String... aliases) throws GeneralSecurityException Creates a new trust manager factory.- Parameters:
keystore
- to initialize the trust manager factoryaliases
- to include from the supplied keystore or null to include all entries- Returns:
- trust manager factory
- Throws:
GeneralSecurityException
- if the trust manager factory cannot be initialized
-
getKeyManagers
Description copied from interface:SSLContextInitializer
Returns the key managers used when creating SSL contexts.- Returns:
- key managers
- Throws:
GeneralSecurityException
- if an errors occurs while loading the KeyManagers
-
getKeyManagerFactory
protected KeyManagerFactory getKeyManagerFactory(KeyStore keystore, char[] password, String... aliases) throws GeneralSecurityException Creates a new key manager factory.- Parameters:
keystore
- to initialize the key manager factorypassword
- to unlock the supplied keystorealiases
- to include from the supplied keystore or null to include all entries- Returns:
- key manager factory
- Throws:
GeneralSecurityException
- if the key manager factory cannot be initialized
-
toString
-