org.h2.security
Class SecureSocketFactory

java.lang.Object
  extended by org.h2.security.SecureSocketFactory

public class SecureSocketFactory
extends java.lang.Object

A factory to create encrypted sockets. To generate new keystore, use the SecureKeyStoreBuilder tool.


Field Summary
static java.lang.String KEYSTORE_PASSWORD
          The default password to use for the .h2.keystore file
 
Method Summary
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 java.security.KeyStore getKeyStore(java.lang.String password)
          Get the keystore object using the given password.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEYSTORE_PASSWORD

public static final java.lang.String KEYSTORE_PASSWORD
The default password to use for the .h2.keystore file

See Also:
Constant Field Values
Method Detail

createSocket

public static java.net.Socket createSocket(java.net.InetAddress address,
                                           int port)
                                    throws java.io.IOException
Create a secure client socket that is connected to the given address and port.

Parameters:
address - the address to connect to
port - the port
Returns:
the socket
Throws:
java.io.IOException

createServerSocket

public static java.net.ServerSocket createServerSocket(int port,
                                                       java.net.InetAddress bindAddress)
                                                throws java.io.IOException
Create a secure server socket. If a bind address is specified, the socket is only bound to this address.

Parameters:
port - the port to listen on
bindAddress - the address to bind to, or null to bind to all addresses
Returns:
the server socket
Throws:
java.io.IOException

getKeyStore

public static java.security.KeyStore getKeyStore(java.lang.String password)
                                          throws java.io.IOException
Get the keystore object using the given password.

Parameters:
password - the keystore password
Returns:
the keystore
Throws:
java.io.IOException