Package org.ldaptive.ssl
Class KeyStoreSSLContextInitializer
- java.lang.Object
- 
- org.ldaptive.ssl.AbstractSSLContextInitializer
- 
- org.ldaptive.ssl.KeyStoreSSLContextInitializer
 
 
- 
- All Implemented Interfaces:
- SSLContextInitializer
 
 public class KeyStoreSSLContextInitializer extends AbstractSSLContextInitializer Provides an SSL context initializer which can use java KeyStores to create key and trust managers.
- 
- 
Field SummaryFields Modifier and Type Field Description private String[]authenticationAliasesAliases of key entries to use.private KeyStoreauthenticationKeystoreKeyStore used to create key managers.private char[]authenticationPasswordPassword used to access the authentication keystore.private String[]trustAliasesAliases of trust entries to use.private KeyStoretrustKeystoreKeyStore used to create trust managers.- 
Fields inherited from class org.ldaptive.ssl.AbstractSSLContextInitializerlogger, trustManagers
 
- 
 - 
Constructor SummaryConstructors Constructor Description KeyStoreSSLContextInitializer()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected TrustManager[]createTrustManagers()Creates any trust managers specific to this context initializer.String[]getAuthenticationAliases()Returns the aliases of the entries to use in the authentication keystoreKeyStoregetAuthenticationKeystore()Returns the keystore to use for creating the key managers.char[]getAuthenticationPassword()Returns the password used for accessing the authentication keystore.protected KeyManagerFactorygetKeyManagerFactory(KeyStore keystore, char[] password, String... aliases)Creates a new key manager factory.KeyManager[]getKeyManagers()Returns the key managers used when creating SSL contexts.String[]getTrustAliases()Returns the aliases of the entries to use in the trust keystoreKeyStoregetTrustKeystore()Returns the keystore to use for creating the trust managers.protected TrustManagerFactorygetTrustManagerFactory(KeyStore keystore, String... aliases)Creates a new trust manager factory.voidsetAuthenticationAliases(String... aliases)Sets the aliases of the entries to use in the authentication keystore.voidsetAuthenticationKeystore(KeyStore keystore)Sets the keystore to use for creating the key managers.voidsetAuthenticationPassword(char[] password)Sets the password used for accessing the authentication keystore.voidsetTrustAliases(String... aliases)Sets the aliases of the entries to use in the trust keystore.voidsetTrustKeystore(KeyStore keystore)Sets the keystore to use for creating the trust managers.StringtoString()- 
Methods inherited from class org.ldaptive.ssl.AbstractSSLContextInitializeraggregateTrustManagers, getTrustManagers, initSSLContext, setTrustManagers
 
- 
 
- 
- 
- 
Field Detail- 
trustKeystoreprivate KeyStore trustKeystore KeyStore used to create trust managers.
 - 
trustAliasesprivate String[] trustAliases Aliases of trust entries to use.
 - 
authenticationKeystoreprivate KeyStore authenticationKeystore KeyStore used to create key managers.
 - 
authenticationAliasesprivate String[] authenticationAliases Aliases of key entries to use.
 - 
authenticationPasswordprivate char[] authenticationPassword Password used to access the authentication keystore.
 
- 
 - 
Method Detail- 
getTrustKeystorepublic KeyStore getTrustKeystore() Returns the keystore to use for creating the trust managers.- Returns:
- keystore
 
 - 
setTrustKeystorepublic void setTrustKeystore(KeyStore keystore) Sets the keystore to use for creating the trust managers.- Parameters:
- keystore- to set
 
 - 
getTrustAliasespublic String[] getTrustAliases() Returns the aliases of the entries to use in the trust keystore- Returns:
- trust aliases
 
 - 
setTrustAliasespublic void setTrustAliases(String... aliases) Sets the aliases of the entries to use in the trust keystore.- Parameters:
- aliases- to use
 
 - 
getAuthenticationKeystorepublic KeyStore getAuthenticationKeystore() Returns the keystore to use for creating the key managers.- Returns:
- keystore
 
 - 
setAuthenticationKeystorepublic void setAuthenticationKeystore(KeyStore keystore) Sets the keystore to use for creating the key managers.- Parameters:
- keystore- to set
 
 - 
getAuthenticationAliasespublic String[] getAuthenticationAliases() Returns the aliases of the entries to use in the authentication keystore- Returns:
- authentication aliases
 
 - 
setAuthenticationAliasespublic void setAuthenticationAliases(String... aliases) Sets the aliases of the entries to use in the authentication keystore.- Parameters:
- aliases- to use
 
 - 
getAuthenticationPasswordpublic char[] getAuthenticationPassword() Returns the password used for accessing the authentication keystore.- Returns:
- authentication password
 
 - 
setAuthenticationPasswordpublic void setAuthenticationPassword(char[] password) Sets the password used for accessing the authentication keystore.- Parameters:
- password- to use for authentication
 
 - 
createTrustManagersprotected TrustManager[] createTrustManagers() throws GeneralSecurityException Description copied from class:AbstractSSLContextInitializerCreates any trust managers specific to this context initializer.- Specified by:
- createTrustManagersin class- AbstractSSLContextInitializer
- Returns:
- trust managers
- Throws:
- GeneralSecurityException- if an errors occurs while loading the TrustManagers
 
 - 
getTrustManagerFactoryprotected TrustManagerFactory getTrustManagerFactory(KeyStore keystore, String... aliases) throws GeneralSecurityException Creates a new trust manager factory.- Parameters:
- keystore- to initialize the trust manager factory
- aliases- 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
 
 - 
getKeyManagerspublic KeyManager[] getKeyManagers() throws GeneralSecurityException Description copied from interface:SSLContextInitializerReturns the key managers used when creating SSL contexts.- Returns:
- key managers
- Throws:
- GeneralSecurityException- if an errors occurs while loading the KeyManagers
 
 - 
getKeyManagerFactoryprotected KeyManagerFactory getKeyManagerFactory(KeyStore keystore, char[] password, String... aliases) throws GeneralSecurityException Creates a new key manager factory.- Parameters:
- keystore- to initialize the key manager factory
- password- to unlock the supplied keystore
- aliases- 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
 
 
- 
 
-