Class SSLFactoryBuilder

  extended byorg.apache.avalon.framework.logger.AbstractLogEnabled
      extended byorg.apache.avalon.cornerstone.blocks.sockets.SSLFactoryBuilder
All Implemented Interfaces:
Configurable, Contextualizable, Disposable, Initializable, LogEnabled

public class SSLFactoryBuilder
extends AbstractLogEnabled
implements Configurable, Contextualizable, Disposable, Initializable

Builds SSLContexts with desired properties. Hides all the gory details of SSLContext productions behind nice Avalon interfaces. Married to Sun JCA implementation.

Configuration looks like:

      <file>conf/keystore</file> <!-- keystore file location -->
      <password></password> <!-- Key Store file password, only used to check keystore integrity -->
      <key-password></key-password> <!-- Only required when you need to decrypt a private key -->
     <type>JKS</type> <!-- Key Store file format, defaults to JKS -->
     <algorithm>SunX509</algorithm> <!-- Cryptography provider ID, defaults to SunX509 -->
   <!-- SSL protocol to use, defaults to TLS, another possible value is SSL -->

Notes on keystore files. Absolute paths are supported. Relative paths are interpreted relative to .sar base directory. Defaults to conf/keystore. Since keystore usually contains sensitive keys it maybe beneficial to not include the keystores into the .sar files.

Greg Steuck

Constructor Summary
Method Summary buildServerSocketFactory()
          Produces a fresh ssl server socket factory with configured parameters. buildSocketFactory()
          Produces a fresh ssl socket factory with configured parameters.
 void configure(Configuration configuration)
          Pass the Configuration to the Configurable class.
 void contextualize(Context context)
          Requires a BlockContext.
 void dispose()
          The dispose operation is called at the end of a components lifecycle.
 void initialize()
          Initialize the component.
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public SSLFactoryBuilder()
Method Detail


public void contextualize(Context context)
                   throws ContextException
Requires a BlockContext. We'll see how we end up expressing these dependencies.

Specified by:
contextualize in interface Contextualizable
context - the context. Must not be null.
ContextException - if context is invalid


public void configure(Configuration configuration)
               throws ConfigurationException
Description copied from interface: Configurable
Pass the Configuration to the Configurable class.

Specified by:
configure in interface Configurable
configuration - the class configurations. Must not be null.
ConfigurationException - if an error occurs


public buildSocketFactory()
Produces a fresh ssl socket factory with configured parameters.


public buildServerSocketFactory()
Produces a fresh ssl server socket factory with configured parameters.


public void initialize()
Description copied from interface: Initializable
Initialize the component. Initialization includes allocating any resources required throughout the component's lifecycle.

Specified by:
initialize in interface Initializable


public void dispose()
Description copied from interface: Disposable
The dispose operation is called at the end of a components lifecycle. This method will be called after Startable.stop() method (if implemented by component). Components use this method to release and destroy any resources that the Component owns.

Specified by:
dispose in interface Disposable

Copyright © 1997-2005 The Apache Software Foundation. All Rights Reserved.