org.apache.commons.ssl
Class SSLServer

java.lang.Object
  extended byjavax.net.ServerSocketFactory
      extended byjavax.net.ssl.SSLServerSocketFactory
          extended byorg.apache.commons.ssl.SSLServer

public class SSLServer
extends javax.net.ssl.SSLServerSocketFactory

Since:
May 1, 2006
Author:
Credit Union Central of British Columbia, www.cucbc.com, juliusdavies@cucbc.com

Field Summary
protected  SSL ssl
           
 
Constructor Summary
SSLServer()
           
 
Method Summary
 void addAllowedName(java.lang.String s)
           
 void addAllowedNames(java.util.Collection c)
           
 void addTrustMaterial(TrustChain trustChain)
           
 void clearAllowedNames()
           
 java.net.ServerSocket createServerSocket()
           
 java.net.ServerSocket createServerSocket(int port)
           
 java.net.ServerSocket createServerSocket(int port, int backlog)
           
 java.net.ServerSocket createServerSocket(int port, int backlog, java.net.InetAddress localHost)
          Attempts to get a new socket connection to the given host within the given time limit.
 java.util.List getAllowedNames()
           
 java.security.cert.X509Certificate[] getAssociatedCertificateChain()
           
 boolean getCheckCRL()
           
 boolean getCheckExpiry()
           
 boolean getCheckHostname()
           
 int getConnectTimeout()
           
 java.security.cert.X509Certificate[] getCurrentClientChain()
           
 java.lang.String[] getDefaultCipherSuites()
           
 java.lang.String getDefaultProtocol()
           
 java.lang.String[] getEnabledCiphers()
           
 java.lang.String[] getEnabledProtocols()
           
 HostnameVerifier getHostnameVerifier()
           
 boolean getNeedClientAuth()
           
 int getSoTimeout()
           
 javax.net.ssl.SSLContext getSSLContext()
           
 SSLWrapperFactory getSSLWrapperFactory()
           
 java.lang.String[] getSupportedCipherSuites()
           
 TrustChain getTrustChain()
           
 boolean getUseClientMode()
           
 boolean getWantClientAuth()
           
 void setCheckCRL(boolean b)
           
 void setCheckExpiry(boolean b)
           
 void setCheckHostname(boolean b)
           
 void setConnectTimeout(int i)
           
 void setDefaultProtocol(java.lang.String s)
           
 void setEnabledCiphers(java.lang.String[] ciphers)
           
 void setEnabledProtocols(java.lang.String[] protocols)
           
 void setHostnameVerifier(HostnameVerifier verifier)
           
 void setKeyMaterial(KeyMaterial keyMaterial)
           
 void setNeedClientAuth(boolean b)
           
 void setSoTimeout(int soTimeout)
           
 void setSSLWrapperFactory(SSLWrapperFactory wf)
           
 void setTrustMaterial(TrustChain trustChain)
           
 void setUseClientMode(boolean b)
           
 void setWantClientAuth(boolean b)
           
 void useDefaultJavaCiphers()
           
 void useStrongCiphers()
           
 boolean useTomcatSSLMaterial()
          Tries to extract the TrustMaterial and KeyMaterial being used by a Tomcat SSL server (usually on 8443) by analyzing Tomcat's "server.xml" file.
 
Methods inherited from class javax.net.ssl.SSLServerSocketFactory
getDefault
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ssl

protected final SSL ssl
Constructor Detail

SSLServer

public SSLServer()
          throws java.security.GeneralSecurityException,
                 java.io.IOException
Method Detail

useTomcatSSLMaterial

public boolean useTomcatSSLMaterial()
                             throws java.security.GeneralSecurityException,
                                    java.io.IOException
Tries to extract the TrustMaterial and KeyMaterial being used by a Tomcat SSL server (usually on 8443) by analyzing Tomcat's "server.xml" file. If the extraction is successful, the TrustMaterial and KeyMaterial are applied to this SSLServer.

Returns:
true if the operation was successful.
Throws:
java.security.GeneralSecurityException - setKeyMaterial() failed
java.io.IOException - setKeyMaterial() failed

addTrustMaterial

public void addTrustMaterial(TrustChain trustChain)
                      throws java.security.NoSuchAlgorithmException,
                             java.security.KeyStoreException,
                             java.security.KeyManagementException,
                             java.io.IOException,
                             java.security.cert.CertificateException
Throws:
java.security.NoSuchAlgorithmException
java.security.KeyStoreException
java.security.KeyManagementException
java.io.IOException
java.security.cert.CertificateException

setTrustMaterial

public void setTrustMaterial(TrustChain trustChain)
                      throws java.security.NoSuchAlgorithmException,
                             java.security.KeyStoreException,
                             java.security.KeyManagementException,
                             java.io.IOException,
                             java.security.cert.CertificateException
Throws:
java.security.NoSuchAlgorithmException
java.security.KeyStoreException
java.security.KeyManagementException
java.io.IOException
java.security.cert.CertificateException

setKeyMaterial

public void setKeyMaterial(KeyMaterial keyMaterial)
                    throws java.security.NoSuchAlgorithmException,
                           java.security.KeyStoreException,
                           java.security.KeyManagementException,
                           java.io.IOException,
                           java.security.cert.CertificateException
Throws:
java.security.NoSuchAlgorithmException
java.security.KeyStoreException
java.security.KeyManagementException
java.io.IOException
java.security.cert.CertificateException

addAllowedName

public void addAllowedName(java.lang.String s)

addAllowedNames

public void addAllowedNames(java.util.Collection c)

clearAllowedNames

public void clearAllowedNames()

setCheckCRL

public void setCheckCRL(boolean b)

setCheckExpiry

public void setCheckExpiry(boolean b)

setCheckHostname

public void setCheckHostname(boolean b)

setConnectTimeout

public void setConnectTimeout(int i)

setDefaultProtocol

public void setDefaultProtocol(java.lang.String s)

useDefaultJavaCiphers

public void useDefaultJavaCiphers()

useStrongCiphers

public void useStrongCiphers()

setEnabledCiphers

public void setEnabledCiphers(java.lang.String[] ciphers)

setEnabledProtocols

public void setEnabledProtocols(java.lang.String[] protocols)

setHostnameVerifier

public void setHostnameVerifier(HostnameVerifier verifier)

setSoTimeout

public void setSoTimeout(int soTimeout)

setSSLWrapperFactory

public void setSSLWrapperFactory(SSLWrapperFactory wf)

setNeedClientAuth

public void setNeedClientAuth(boolean b)

setWantClientAuth

public void setWantClientAuth(boolean b)

setUseClientMode

public void setUseClientMode(boolean b)

getAllowedNames

public java.util.List getAllowedNames()

getAssociatedCertificateChain

public java.security.cert.X509Certificate[] getAssociatedCertificateChain()

getCheckCRL

public boolean getCheckCRL()

getCheckExpiry

public boolean getCheckExpiry()

getCheckHostname

public boolean getCheckHostname()

getConnectTimeout

public int getConnectTimeout()

getDefaultProtocol

public java.lang.String getDefaultProtocol()

getEnabledCiphers

public java.lang.String[] getEnabledCiphers()

getEnabledProtocols

public java.lang.String[] getEnabledProtocols()

getHostnameVerifier

public HostnameVerifier getHostnameVerifier()

getSoTimeout

public int getSoTimeout()

getSSLWrapperFactory

public SSLWrapperFactory getSSLWrapperFactory()

getNeedClientAuth

public boolean getNeedClientAuth()

getWantClientAuth

public boolean getWantClientAuth()

getUseClientMode

public boolean getUseClientMode()

getSSLContext

public javax.net.ssl.SSLContext getSSLContext()
                                       throws java.security.GeneralSecurityException,
                                              java.io.IOException
Throws:
java.security.GeneralSecurityException
java.io.IOException

getTrustChain

public TrustChain getTrustChain()

getCurrentClientChain

public java.security.cert.X509Certificate[] getCurrentClientChain()

getDefaultCipherSuites

public java.lang.String[] getDefaultCipherSuites()

getSupportedCipherSuites

public java.lang.String[] getSupportedCipherSuites()

createServerSocket

public java.net.ServerSocket createServerSocket()
                                         throws java.io.IOException
Throws:
java.io.IOException

createServerSocket

public java.net.ServerSocket createServerSocket(int port)
                                         throws java.io.IOException
Throws:
java.io.IOException

createServerSocket

public java.net.ServerSocket createServerSocket(int port,
                                                int backlog)
                                         throws java.io.IOException
Throws:
java.io.IOException

createServerSocket

public java.net.ServerSocket createServerSocket(int port,
                                                int backlog,
                                                java.net.InetAddress localHost)
                                         throws java.io.IOException
Attempts to get a new socket connection to the given host within the given time limit.

Parameters:
localHost - the local host name/IP to bind against (null == ANY)
port - the port to listen on
backlog - number of connections allowed to queue up for accept().
Returns:
SSLServerSocket a new server socket
Throws:
java.io.IOException - if an I/O error occurs while creating thesocket


Copyright © 2011. All Rights Reserved.