org.apache.commons.ssl
Class SSLClient
java.lang.Object
javax.net.SocketFactory
javax.net.ssl.SSLSocketFactory
org.apache.commons.ssl.SSLClient
- Direct Known Subclasses:
- CRLSocket, HttpSecureProtocol, LDAPSocket
public class SSLClient
- extends SSLSocketFactory
- Since:
- 27-Feb-2006
- Author:
- Credit Union Central of British Columbia, www.cucbc.com, juliusdavies@cucbc.com
Method Summary |
void |
addTrustMaterial(TrustChain trustChain)
|
Socket |
createSocket()
|
Socket |
createSocket(InetAddress host,
int port)
|
Socket |
createSocket(InetAddress host,
int port,
InetAddress localHost,
int localPort)
|
Socket |
createSocket(Socket s,
String remoteHost,
int remotePort,
boolean autoClose)
|
Socket |
createSocket(String host,
int port)
|
Socket |
createSocket(String host,
int port,
InetAddress localHost,
int localPort)
|
Socket |
createSocket(String host,
int port,
InetAddress localHost,
int localPort,
int timeout)
Attempts to get a new socket connection to the given host within the
given time limit. |
X509Certificate[] |
getAssociatedCertificateChain()
|
boolean |
getCheckCRL()
|
boolean |
getCheckExpiry()
|
boolean |
getCheckHostname()
|
int |
getConnectTimeout()
|
X509Certificate[] |
getCurrentServerChain()
|
String[] |
getDefaultCipherSuites()
|
String |
getDefaultProtocol()
|
String[] |
getEnabledCiphers()
|
String[] |
getEnabledProtocols()
|
HostnameVerifier |
getHostnameVerifier()
|
boolean |
getNeedClientAuth()
|
int |
getSoTimeout()
|
SSLContext |
getSSLContext()
|
SSLWrapperFactory |
getSSLWrapperFactory()
|
String[] |
getSupportedCipherSuites()
|
TrustChain |
getTrustChain()
|
boolean |
getUseClientMode()
|
boolean |
getWantClientAuth()
|
boolean |
isSecure()
|
void |
setCheckCRL(boolean b)
|
void |
setCheckExpiry(boolean b)
|
void |
setCheckHostname(boolean b)
|
void |
setConnectTimeout(int i)
|
void |
setDefaultProtocol(String s)
|
void |
setDnsOverride(Map m)
|
void |
setEnabledCiphers(String[] ciphers)
|
void |
setEnabledProtocols(String[] protocols)
|
void |
setHostnameVerifier(HostnameVerifier verifier)
|
void |
setIsSecure(boolean b)
|
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()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ssl
private final SSL ssl
SSLClient
public SSLClient()
throws GeneralSecurityException,
IOException
- Throws:
GeneralSecurityException
IOException
addTrustMaterial
public void addTrustMaterial(TrustChain trustChain)
throws NoSuchAlgorithmException,
KeyStoreException,
KeyManagementException,
IOException,
CertificateException
- Throws:
NoSuchAlgorithmException
KeyStoreException
KeyManagementException
IOException
CertificateException
setTrustMaterial
public void setTrustMaterial(TrustChain trustChain)
throws NoSuchAlgorithmException,
KeyStoreException,
KeyManagementException,
IOException,
CertificateException
- Throws:
NoSuchAlgorithmException
KeyStoreException
KeyManagementException
IOException
CertificateException
setKeyMaterial
public void setKeyMaterial(KeyMaterial keyMaterial)
throws NoSuchAlgorithmException,
KeyStoreException,
KeyManagementException,
IOException,
CertificateException
- Throws:
NoSuchAlgorithmException
KeyStoreException
KeyManagementException
IOException
CertificateException
setIsSecure
public void setIsSecure(boolean b)
setDnsOverride
public void setDnsOverride(Map m)
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(String s)
useDefaultJavaCiphers
public void useDefaultJavaCiphers()
useStrongCiphers
public void useStrongCiphers()
setEnabledCiphers
public void setEnabledCiphers(String[] ciphers)
setEnabledProtocols
public void setEnabledProtocols(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)
isSecure
public boolean isSecure()
getAssociatedCertificateChain
public X509Certificate[] getAssociatedCertificateChain()
getCheckCRL
public boolean getCheckCRL()
getCheckExpiry
public boolean getCheckExpiry()
getCheckHostname
public boolean getCheckHostname()
getConnectTimeout
public int getConnectTimeout()
getDefaultProtocol
public String getDefaultProtocol()
getEnabledCiphers
public String[] getEnabledCiphers()
getEnabledProtocols
public 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 SSLContext getSSLContext()
throws GeneralSecurityException,
IOException
- Throws:
GeneralSecurityException
IOException
getTrustChain
public TrustChain getTrustChain()
getCurrentServerChain
public X509Certificate[] getCurrentServerChain()
getDefaultCipherSuites
public String[] getDefaultCipherSuites()
- Specified by:
getDefaultCipherSuites
in class SSLSocketFactory
getSupportedCipherSuites
public String[] getSupportedCipherSuites()
- Specified by:
getSupportedCipherSuites
in class SSLSocketFactory
createSocket
public Socket createSocket()
throws IOException
- Overrides:
createSocket
in class SocketFactory
- Throws:
IOException
createSocket
public Socket createSocket(String host,
int port)
throws IOException
- Specified by:
createSocket
in class SocketFactory
- Throws:
IOException
createSocket
public Socket createSocket(InetAddress host,
int port)
throws IOException
- Specified by:
createSocket
in class SocketFactory
- Throws:
IOException
createSocket
public Socket createSocket(InetAddress host,
int port,
InetAddress localHost,
int localPort)
throws IOException
- Specified by:
createSocket
in class SocketFactory
- Throws:
IOException
createSocket
public Socket createSocket(String host,
int port,
InetAddress localHost,
int localPort)
throws IOException
- Specified by:
createSocket
in class SocketFactory
- Throws:
IOException
createSocket
public Socket createSocket(String host,
int port,
InetAddress localHost,
int localPort,
int timeout)
throws IOException
- Attempts to get a new socket connection to the given host within the
given time limit.
- Parameters:
host
- the host name/IPport
- the port on the hostlocalHost
- the local host name/IP to bind the socket tolocalPort
- the port on the local machinetimeout
- the connection timeout (0==infinite)
- Returns:
- Socket a new socket
- Throws:
IOException
- if an I/O error occurs while creating thesocket
UnknownHostException
- if the IP address of the host cannot be
determined
createSocket
public Socket createSocket(Socket s,
String remoteHost,
int remotePort,
boolean autoClose)
throws IOException
- Specified by:
createSocket
in class SSLSocketFactory
- Throws:
IOException