public class X509SSLContextFactory extends DefaultSSLContextFactory
SSLContextFactory.SSLContextFactoryException
Modifier and Type | Field and Description |
---|---|
static String |
KEY_PASSWORD_PROP |
static String |
KEYSTORE_FILE_PROP |
static String |
KEYSTORE_PASSWORD_PROP |
static String |
KEYSTORE_PROVIDER_ARGFILE_PROP |
static String |
KEYSTORE_PROVIDER_ARGTEXT_PROP |
static String |
KEYSTORE_PROVIDER_CLASS_PROP |
static String |
KEYSTORE_PROVIDER_PROP |
static String |
KEYSTORE_TYPE_PROP |
static String |
TRUSTSTORE_FILE_PROP |
static String |
TRUSTSTORE_PASSWORD_PROP |
static String |
TRUSTSTORE_PROVIDER_ARGFILE_PROP |
static String |
TRUSTSTORE_PROVIDER_ARGTEXT_PROP |
static String |
TRUSTSTORE_PROVIDER_CLASS_PROP |
static String |
TRUSTSTORE_PROVIDER_PROP |
static String |
TRUSTSTORE_TYPE_PROP |
CONTEXT_PROTOCOL_NAME_PROP, CONTEXT_PROVIDER_NAME_PROP, SECURERANDOM_ALGORITHM_PROP, SECURERANDOM_PROVIDER_NAME_PROP
Constructor and Description |
---|
X509SSLContextFactory()
Builds an SSLContextFactory using the SunX509 algorithm in the
TrustManagerFactory.
|
X509SSLContextFactory(KeyStore keyStore,
char[] keyPassword,
KeyStore trustStore)
Builds an SSLContextFactory using the SunX509 algorithm in the
TrustManagerFactory.
|
X509SSLContextFactory(KeyStore keyStore,
String keyPassword,
KeyStore trustStore)
Builds an SSLContextFactory using the SunX509 algorithm in the
TrustManagerFactory.
|
Modifier and Type | Method and Description |
---|---|
void |
configure(Properties properties)
Configures some this factory based on values in the properties.
|
KeyManager[] |
getKeyManagers()
Gets the trust managers.
|
protected KeyStore |
getKeyStore()
Returns the key store.
|
protected KeyManager[] |
getRawKeyManagers()
Builds KeyManagers from the key store provided in the constructor, using
a SunX509 KeyManagerFactory.
|
protected TrustManager[] |
getRawTrustManagers()
Builds TrustManagers from the trust store provided in the constructor,
using a SunX509 TrustManagerFactory.
|
TrustManager[] |
getTrustManagers()
Gets the trust managers.
|
protected KeyStore |
getTrustStore()
Returns the trust store.
|
void |
setKeyManagerWrapper(X509KeyManagerWrapper keyManagerWrapper)
Sets the key manager wrapper.
|
void |
setKeyPassword(char[] keyPassword)
Sets the key password
|
void |
setKeyPasswordCallbackHandler(CallbackHandler keyPasswordCallbackHandler)
Sets the CallbackHandler that will be used to obtain the key password if
this password is still null.
|
void |
setKeyStore(KeyStore keyStore)
Sets the key store.
|
void |
setKeyStorePasswordCallbackHandler(CallbackHandler keyStorePasswordCallbackHandler)
Sets the CallbackHandler that will be used to obtain the key password if
this password is still null.
|
void |
setTrustManagerWrapper(X509TrustManagerWrapper trustManagerWrapper)
Sets the trust manager wrapper.
|
void |
setTrustStore(KeyStore trustStore)
Sets the trust store.
|
void |
setTrustStorePasswordCallbackHandler(CallbackHandler trustStorePasswordCallbackHandler)
Sets the CallbackHandler that will be used to obtain the key password if
this password is still null.
|
buildSSLContext, buildSSLContext, clone, getContextProtocol, getContextProvider, getDefaultSecureRandomAlgorithm, getSecureRandom, getSecureRandomProvider, setSecureRandom
public static final String KEYSTORE_FILE_PROP
public static final String KEYSTORE_TYPE_PROP
public static final String KEYSTORE_PROVIDER_PROP
public static final String KEYSTORE_PASSWORD_PROP
public static final String KEYSTORE_PROVIDER_CLASS_PROP
public static final String KEYSTORE_PROVIDER_ARGFILE_PROP
public static final String KEYSTORE_PROVIDER_ARGTEXT_PROP
public static final String KEY_PASSWORD_PROP
public static final String TRUSTSTORE_FILE_PROP
public static final String TRUSTSTORE_TYPE_PROP
public static final String TRUSTSTORE_PROVIDER_PROP
public static final String TRUSTSTORE_PASSWORD_PROP
public static final String TRUSTSTORE_PROVIDER_CLASS_PROP
public static final String TRUSTSTORE_PROVIDER_ARGFILE_PROP
public static final String TRUSTSTORE_PROVIDER_ARGTEXT_PROP
public X509SSLContextFactory()
public X509SSLContextFactory(KeyStore keyStore, String keyPassword, KeyStore trustStore)
keyStore
- KeyStore that contains the key.keyPassword
- password to the key.trustStore
- KeyStore that contains the trusted X.509 certificates.public X509SSLContextFactory(KeyStore keyStore, char[] keyPassword, KeyStore trustStore)
keyStore
- KeyStore that contains the key.keyPassword
- password to the key.trustStore
- KeyStore that contains the trusted X.509 certificates.public void configure(Properties properties) throws SSLContextFactory.SSLContextFactoryException
DefaultSSLContextFactory.configure(Properties)
, the following
properties are used:
Property name | Description |
---|---|
org.jsslutils.prop.keyStore | Path to the KeyStore file to use as the keystore; use "NONE"
if it's not file-based. |
org.jsslutils.prop.keyStoreType | Keystore type for the keystore. |
org.jsslutils.prop.keyStoreProvider | Name of the security Provider to use to load the keystore. |
org.jsslutils.prop.keyStorePassword | Password to load the keystore. |
org.jsslutils.prop.keyStoreProviderClass | Name of the Provider class to use to load the keystore,
typically used with a provider arg file or text; this takes precedence
over loading via provider name. |
org.jsslutils.prop.keyStoreProviderArgFile | Path to the file to use as an argument when instantiating the
keystore Provider via its class name |
org.jsslutils.prop.keyStoreProviderArgText | Text content of the argument when instantiating the keystore
Provider via its class name. |
org.jsslutils.prop.keyPassword | Password to use the key itself from the keystore. |
org.jsslutils.prop.trustStore | Path to the KeyStore file to use as the truststore; use
"NONE" if it's not file-based. |
org.jsslutils.prop.trustStoreType | Keystore type for the truststore. |
org.jsslutils.prop.trustStoreProvider | Name of the security Provider to use to load the truststore. |
org.jsslutils.prop.trustStorePassword | Password to load the truststore. |
org.jsslutils.prop.trustStoreProviderClass | Name of the Provider class to use to load the truststore,
typically used with a provider arg file or text; this takes precedence
over loading via provider name. |
org.jsslutils.prop.trustStoreProviderArgFile | Path to the file to use as an argument when instantiating the
truststore Provider via its class name |
org.jsslutils.prop.trustStoreProviderArgText | Text content of the argument when instantiating the truststore
Provider via its class name. |
configure
in interface SSLContextFactory
configure
in class DefaultSSLContextFactory
properties
- properties to use for the configuration.SSLContextFactory.SSLContextFactoryException
public void setKeyStore(KeyStore keyStore)
keyStore
- the key store.public void setTrustStore(KeyStore trustStore)
trustStore
- the trust store.protected KeyStore getKeyStore()
protected KeyStore getTrustStore()
public void setKeyPassword(char[] keyPassword)
keyPassword
- public void setKeyPasswordCallbackHandler(CallbackHandler keyPasswordCallbackHandler)
keyPasswordCallbackHandler
- CallbackHandler that will be used to get the password.public void setKeyStorePasswordCallbackHandler(CallbackHandler keyStorePasswordCallbackHandler)
keyStorePasswordCallbackHandler
- CallbackHandler that will be used to get the password.public void setTrustStorePasswordCallbackHandler(CallbackHandler trustStorePasswordCallbackHandler)
trustStorePasswordCallbackHandler
- CallbackHandler that will be used to get the password.protected KeyManager[] getRawKeyManagers() throws SSLContextFactory.SSLContextFactoryException
SSLContextFactory.SSLContextFactoryException
public void setKeyManagerWrapper(X509KeyManagerWrapper keyManagerWrapper)
keyManagerWrapper
- public KeyManager[] getKeyManagers() throws SSLContextFactory.SSLContextFactoryException
getKeyManagers
in class DefaultSSLContextFactory
SSLContextFactory.SSLContextFactoryException
protected TrustManager[] getRawTrustManagers() throws SSLContextFactory.SSLContextFactoryException
SSLContextFactory.SSLContextFactoryException
public void setTrustManagerWrapper(X509TrustManagerWrapper trustManagerWrapper)
trustManagerWrapper
- public TrustManager[] getTrustManagers() throws SSLContextFactory.SSLContextFactoryException
getTrustManagers
in class DefaultSSLContextFactory
SSLContextFactory.SSLContextFactoryException
Copyright © 2018. All rights reserved.