public class CipherFactory
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DEFAULT_LEGACY_ALGORITHMS
The value of "jdk.tls.legacyAlgorithms" security
property at the time of class initialization.
|
static java.lang.String |
KEYSTORE_PASSWORD
The default password to use for the .h2.keystore file
|
static java.lang.String |
LEGACY_ALGORITHMS_SECURITY_KEY
The security property which can prevent anonymous TLS connections.
|
| Modifier and Type | Method and Description |
|---|---|
static java.net.ServerSocket |
createServerSocket(int port,
java.net.InetAddress bindAddress)
Create a secure server socket.
|
static java.net.Socket |
createSocket(java.net.InetAddress address,
int port)
Create a secure client socket that is connected to the given address and
port.
|
static BlockCipher |
getBlockCipher(java.lang.String algorithm)
Get a new block cipher object for the given algorithm.
|
static java.security.KeyStore |
getKeyStore(java.lang.String password)
Get the keystore object using the given password.
|
static java.lang.String |
getLegacyAlgorithmsSilently()
Returns the security property "jdk.tls.legacyAlgorithms".
|
static void |
removeAnonFromLegacyAlgorithms()
Attempts to weaken the security properties to allow anonymous TLS.
|
static java.lang.String |
removeDhAnonFromCommaSeparatedList(java.lang.String list)
Removes DH_anon and ECDH_anon from a comma separated list of ciphers.
|
static void |
resetDefaultLegacyAlgorithms()
Attempts to resets the security property to the default value.
|
public static final java.lang.String KEYSTORE_PASSWORD
public static final java.lang.String LEGACY_ALGORITHMS_SECURITY_KEY
public static final java.lang.String DEFAULT_LEGACY_ALGORITHMS
public static BlockCipher getBlockCipher(java.lang.String algorithm)
algorithm - the algorithmpublic static java.net.Socket createSocket(java.net.InetAddress address,
int port)
throws java.io.IOException
address - the address to connect toport - the portjava.io.IOExceptionpublic static java.net.ServerSocket createServerSocket(int port,
java.net.InetAddress bindAddress)
throws java.io.IOException
port - the port to listen onbindAddress - the address to bind to, or null to bind to all
addressesjava.io.IOExceptionremoveAnonFromLegacyAlgorithms()public static java.lang.String removeDhAnonFromCommaSeparatedList(java.lang.String list)
list - a list of names separated by commas (and spaces)public static void removeAnonFromLegacyAlgorithms()
NOTE: In current (as of 2016) default implementations of JSSE which use this security property, the value is permanently cached inside the ServerHandshake class upon its first use. Therefore the modification accomplished by this method has to be done before the first use of a server SSL socket. Later changes to this property will not have any effect on server socket behavior.
public static void resetDefaultLegacyAlgorithms()
NOTE: Resetting the property might not have any effect on server socket behavior.
removeAnonFromLegacyAlgorithms()public static java.lang.String getLegacyAlgorithmsSilently()
public static java.security.KeyStore getKeyStore(java.lang.String password)
throws java.io.IOException
password - the keystore passwordjava.io.IOException