Package biz.onixs.util.network
Class SslContextFactory
- java.lang.Object
-
- biz.onixs.util.network.SslContextFactory
-
public class SslContextFactory extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_PROTOCOLstatic StringKEY_STORE_TYPE
-
Constructor Summary
Constructors Constructor Description SslContextFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static SSLContextgetInstance(String keyStoreName, String trustStoreName, String keyPassword)Returns SSL context.static SSLContextgetInstance(String keyStoreName, String trustStoreName, String keyPassword, String keyStorePassword, String trustStorePassword)Returns SSL context.static SSLContextgetInstance(String protocol, String keyStoreName, String trustStoreName, String keyPassword, String keyStorePassword, String trustStorePassword)Returns SSL context.
-
-
-
Field Detail
-
KEY_STORE_TYPE
public static final String KEY_STORE_TYPE
- See Also:
- Constant Field Values
-
DEFAULT_PROTOCOL
public static final String DEFAULT_PROTOCOL
- See Also:
- Constant Field Values
-
-
Method Detail
-
getInstance
public static SSLContext getInstance(String keyStoreName, String trustStoreName, String keyPassword) throws GeneralSecurityException
Returns SSL context. The key store and trust store passwords are set to empty string.- Parameters:
keyStoreName- key store resource name; is loaded via classpath; if not found the empty keystore is usedtrustStoreName- trust store resource name; is loaded via classpath; can be set tonullif you don't want to validate counterparty's certificatekeyPassword- key password- Returns:
- SSL context
- Throws:
GeneralSecurityException- if security exception occurredNullPointerException- if(keyStoreName == null)or(keyStorePassword == null)
-
getInstance
public static SSLContext getInstance(String keyStoreName, String trustStoreName, String keyPassword, String keyStorePassword, String trustStorePassword) throws GeneralSecurityException
Returns SSL context.- Parameters:
keyStoreName- key store resource name; is loaded via classpath; if not found the empty keystore is usedtrustStoreName- trust store resource name; is loaded via classpath; can be set tonullif you don't want to validate counterparty's certificatekeyPassword- key passwordkeyStorePassword- key store passwordtrustStorePassword- trust store password- Returns:
- SSL context
- Throws:
GeneralSecurityException- if security exception occurredNullPointerException- if(keyStoreName == null)or(keyStorePassword == null)or((trustStoreName != null) && (trustStorePassword == null))
-
getInstance
public static SSLContext getInstance(String protocol, String keyStoreName, String trustStoreName, String keyPassword, String keyStorePassword, String trustStorePassword) throws GeneralSecurityException
Returns SSL context.- Parameters:
protocol- the standard name of the requested protocol. See the SSLContext section in the Java Cryptography Architecture Standard Algorithm Name Documentation for information about standard protocol names.keyStoreName- key store resource name; is loaded via classpath; if not found the empty keystore is usedtrustStoreName- trust store resource name; is loaded via classpath; can be set tonullif you don't want to validate counterparty's certificatekeyPassword- key passwordkeyStorePassword- key store passwordtrustStorePassword- trust store password- Returns:
- SSL context
- Throws:
GeneralSecurityException- if security exception occurredNullPointerException- if(keyStoreName == null)or(keyStorePassword == null)or((trustStoreName != null) && (trustStorePassword == null))
-
-