public class SSL extends Object
Constructor and Description |
---|
SSL() |
private static final String[] KNOWN_PROTOCOLS
private static final String[] SUPPORTED_CIPHERS
public static final SortedSet KNOWN_PROTOCOLS_SET
public static final SortedSet SUPPORTED_CIPHERS_SET
private Object sslContext
private int initCount
private SSLSocketFactory socketFactory
private SSLServerSocketFactory serverSocketFactory
private HostnameVerifier hostnameVerifier
private boolean isSecure
private boolean checkHostname
private boolean checkCRL
private boolean checkExpiry
private boolean useClientMode
private boolean useClientModeDefault
private int soTimeout
private int connectTimeout
private TrustChain trustChain
private KeyMaterial keyMaterial
private String[] enabledCiphers
private String[] enabledProtocols
private String defaultProtocol
private X509Certificate[] currentServerChain
private X509Certificate[] currentClientChain
private boolean wantClientAuth
private boolean needClientAuth
private SSLWrapperFactory sslWrapperFactory
private Map dnsOverride
protected final boolean usingSystemProperties
public SSL() throws GeneralSecurityException, IOException
GeneralSecurityException
IOException
private void dirty()
private void dirtyAndReloadIfYoung() throws NoSuchAlgorithmException, KeyStoreException, KeyManagementException, IOException, CertificateException
String dnsOverride(String host)
public void setDnsOverride(Map m)
public void setIsSecure(boolean b)
public boolean isSecure()
public SSLContext getSSLContext() throws GeneralSecurityException, IOException
GeneralSecurityException
IOException
public Object getSSLContextAsObject() throws GeneralSecurityException, IOException
GeneralSecurityException
- problem creating SSLContextIOException
- problem creating SSLContextpublic void addTrustMaterial(TrustChain trustChain) throws NoSuchAlgorithmException, KeyStoreException, KeyManagementException, IOException, CertificateException
public void setTrustMaterial(TrustChain trustChain) throws NoSuchAlgorithmException, KeyStoreException, KeyManagementException, IOException, CertificateException
public void setKeyMaterial(KeyMaterial keyMaterial) throws NoSuchAlgorithmException, KeyStoreException, KeyManagementException, IOException, CertificateException
public X509Certificate[] getAssociatedCertificateChain()
public String[] getEnabledCiphers()
public void setEnabledCiphers(String[] ciphers)
public String[] getEnabledProtocols()
public void setEnabledProtocols(String[] protocols)
public String getDefaultProtocol()
public void setDefaultProtocol(String protocol)
public boolean getCheckHostname()
public void setCheckHostname(boolean checkHostname)
public void setHostnameVerifier(HostnameVerifier verifier)
public HostnameVerifier getHostnameVerifier()
public boolean getCheckCRL()
public void setCheckCRL(boolean checkCRL)
public boolean getCheckExpiry()
public void setCheckExpiry(boolean checkExpiry)
public void setSoTimeout(int soTimeout)
public int getSoTimeout()
public void setConnectTimeout(int connectTimeout)
public void setUseClientMode(boolean useClientMode)
public boolean getUseClientModeDefault()
public boolean getUseClientMode()
public void setWantClientAuth(boolean wantClientAuth)
public void setNeedClientAuth(boolean needClientAuth)
public boolean getWantClientAuth()
public boolean getNeedClientAuth()
public SSLWrapperFactory getSSLWrapperFactory()
public void setSSLWrapperFactory(SSLWrapperFactory wf)
private void initThrowRuntime()
private void init() throws NoSuchAlgorithmException, KeyStoreException, KeyManagementException, IOException, CertificateException
public void doPreConnectSocketStuff(Socket s) throws IOException
IOException
public void doPostConnectSocketStuff(Socket s, String host) throws IOException
IOException
public Socket createSocket() throws IOException
IOException
public Socket createSocket(String remoteHost, int remotePort, InetAddress localHost, int localPort, int timeout) throws IOException
remoteHost
- the host name/IPremotePort
- 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)IOException
- if an I/O error occurs while creating the socketUnknownHostException
- if the IP address of the host cannot be
determinedpublic Socket createSocket(Socket s, String remoteHost, int remotePort, boolean autoClose) throws IOException
IOException
public ServerSocket createServerSocket() throws IOException
IOException
public ServerSocket createServerSocket(int port, int backlog, InetAddress localHost) throws IOException
localHost
- the local host name/IP to bind against (null == ANY)port
- the port to listen onbacklog
- number of connections allowed to queue up for accept().IOException
- if an I/O error occurs while creating thesocketpublic void doPreConnectServerSocketStuff(SSLServerSocket s) throws IOException
IOException
public SSLSocketFactory getSSLSocketFactory()
public SSLServerSocketFactory getSSLServerSocketFactory()
public int getConnectTimeout()
public String[] getDefaultCipherSuites()
public String[] getSupportedCipherSuites()
public TrustChain getTrustChain()
public void setCurrentServerChain(X509Certificate[] chain)
public void setCurrentClientChain(X509Certificate[] chain)
public X509Certificate[] getCurrentServerChain()
public X509Certificate[] getCurrentClientChain()