Top Description Fields Constructors Methods
org.h2.security

public Class CipherFactory

extends Object
Class Inheritance
Imports
java.io.ByteArrayInputStream, .ByteArrayOutputStream, .IOException, .InputStream, .OutputStream, java.net.InetAddress, .InetSocketAddress, .ServerSocket, .Socket, java.security.KeyFactory, .KeyStore, .PrivateKey, java.security.cert.Certificate, .CertificateFactory, java.security.spec.PKCS8EncodedKeySpec, java.util.Arrays, .HashSet, .Properties, javax.net.ServerSocketFactory, javax.net.ssl.SSLServerSocket, .SSLServerSocketFactory, .SSLSocket, .SSLSocketFactory, org.h2.api.ErrorCode, org.h2.engine.SysProperties, org.h2.message.DbException, org.h2.mvstore.DataUtils, org.h2.store.fs.FileUtils, org.h2.util.IOUtils, .StringUtils

A factory to create new block cipher objects.

Field Summary

Modifier and TypeField and Description
private static final String
private static final String
public static final String
KEYSTORE_PASSWORD

The default password to use for the .h2.keystore file

private static final String

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static ServerSocket

Returns:

the server socket
createServerSocket
(int
the port to listen on
port
,
InetAddress
the address to bind to, or null to bind to all addresses
bindAddress
)

Create a secure server socket.

public static Socket

Returns:

the socket
createSocket
(InetAddress
the address to connect to
address
,
int
the port
port
)

Create a secure client socket that is connected to the given address and port.

private static String[]
disableSSL(String[] enabled)

public static BlockCipher

Returns:

a new cipher object
getBlockCipher
(String
the algorithm
algorithm
)

Get a new block cipher object for the given algorithm.

public static KeyStore

Returns:

the keystore
getKeyStore
(String
the keystore password
password
)

Get the keystore object using the given password.

private static byte[]
getKeyStoreBytes(KeyStore store, String password)

private static void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

KEYSTOREback to summary
private static final String KEYSTORE
KEYSTORE_KEYback to summary
private static final String KEYSTORE_KEY
KEYSTORE_PASSWORDback to summary
public static final String KEYSTORE_PASSWORD

The default password to use for the .h2.keystore file

KEYSTORE_PASSWORD_KEYback to summary
private static final String KEYSTORE_PASSWORD_KEY

Constructor Detail

CipherFactoryback to summary
private CipherFactory()

Method Detail

createServerSocketback to summary
public static ServerSocket createServerSocket(int port, InetAddress bindAddress) throws IOException

Create a secure server socket. If a bind address is specified, the socket is only bound to this address.

Parameters
port:int

the port to listen on

bindAddress:InetAddress

the address to bind to, or null to bind to all addresses

Returns:ServerSocket

the server socket

Exceptions
IOException:
on failure
createSocketback to summary
public static Socket createSocket(InetAddress address, int port) throws IOException

Create a secure client socket that is connected to the given address and port.

Parameters
address:InetAddress

the address to connect to

port:int

the port

Returns:Socket

the socket

Exceptions
IOException:
on failure
disableSSLback to summary
private static String[] disableSSL(String[] enabled)
getBlockCipherback to summary
public static BlockCipher getBlockCipher(String algorithm)

Get a new block cipher object for the given algorithm.

Parameters
algorithm:String

the algorithm

Returns:BlockCipher

a new cipher object

getKeyStoreback to summary
public static KeyStore getKeyStore(String password) throws IOException

Get the keystore object using the given password.

Parameters
password:String

the keystore password

Returns:KeyStore

the keystore

Exceptions
IOException:
on failure
getKeyStoreBytesback to summary
private static byte[] getKeyStoreBytes(KeyStore store, String password) throws IOException
setKeystoreback to summary
private static void setKeystore() throws IOException