Package org.owasp.dependencycheck.utils
Class SSLSocketFactoryEx
- java.lang.Object
-
- javax.net.SocketFactory
-
- javax.net.ssl.SSLSocketFactory
-
- org.owasp.dependencycheck.utils.SSLSocketFactoryEx
-
public class SSLSocketFactoryEx extends javax.net.ssl.SSLSocketFactoryTODO - is this class needed anymore as we do not support Java 6 and 7. This class is used to enable additional ciphers used by the SSL Socket. This is specifically because the NVD stopped supporting TLS 1.0 and Java 6 and 7 clients by default were unable to connect to download the NVD data feeds.The following code was copied from http://stackoverflow.com/questions/1037590/which-cipher-suites-to-enable-for-ssl-socket/23365536#23365536
- Version:
- $Id: $Id
- Author:
- jww
-
-
Constructor Summary
Constructors Constructor Description SSLSocketFactoryEx(javax.net.ssl.KeyManager[] km, javax.net.ssl.TrustManager[] tm, java.security.SecureRandom random, Settings settings)Constructs a new SSLSocketFactory.SSLSocketFactoryEx(javax.net.ssl.SSLContext ctx, Settings settings)Constructs a new SSLSocketFactory.SSLSocketFactoryEx(Settings settings)Constructs a new SSLSocketFactory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.net.SocketcreateSocket(java.lang.String host, int port)java.net.SocketcreateSocket(java.lang.String host, int port, java.net.InetAddress localHost, int localPort)java.net.SocketcreateSocket(java.net.InetAddress host, int port)java.net.SocketcreateSocket(java.net.InetAddress address, int port, java.net.InetAddress localAddress, int localPort)java.net.SocketcreateSocket(java.net.Socket s, java.lang.String host, int port, boolean autoClose)java.lang.String[]getDefaultCipherSuites()java.lang.String[]getDefaultProtocols()Returns the default protocols.protected java.lang.String[]getProtocolList()Returns the protocol list.java.lang.String[]getSupportedCipherSuites()java.lang.String[]getSupportedProtocols()Returns the supported protocols.
-
-
-
Constructor Detail
-
SSLSocketFactoryEx
public SSLSocketFactoryEx(Settings settings) throws java.security.NoSuchAlgorithmException, java.security.KeyManagementException
Constructs a new SSLSocketFactory.- Parameters:
settings- reference to the configured settings- Throws:
java.security.NoSuchAlgorithmException- thrown when an algorithm is not supportedjava.security.KeyManagementException- thrown if initialization fails
-
SSLSocketFactoryEx
public SSLSocketFactoryEx(javax.net.ssl.KeyManager[] km, javax.net.ssl.TrustManager[] tm, java.security.SecureRandom random, Settings settings) throws java.security.NoSuchAlgorithmException, java.security.KeyManagementExceptionConstructs a new SSLSocketFactory.- Parameters:
km- the key managertm- the trust managerrandom- secure randomsettings- reference to the configured settings- Throws:
java.security.NoSuchAlgorithmException- thrown when an algorithm is not supportedjava.security.KeyManagementException- thrown if initialization fails
-
SSLSocketFactoryEx
public SSLSocketFactoryEx(javax.net.ssl.SSLContext ctx, Settings settings) throws java.security.NoSuchAlgorithmException, java.security.KeyManagementExceptionConstructs a new SSLSocketFactory.- Parameters:
ctx- the SSL contextsettings- reference to the configured settings- Throws:
java.security.NoSuchAlgorithmException- thrown when an algorithm is not supportedjava.security.KeyManagementException- thrown if initialization fails
-
-
Method Detail
-
getDefaultCipherSuites
public java.lang.String[] getDefaultCipherSuites()
Returns the default cipher suites.
- Specified by:
getDefaultCipherSuitesin classjavax.net.ssl.SSLSocketFactory
-
getSupportedCipherSuites
public java.lang.String[] getSupportedCipherSuites()
Returns the supported cipher suites.
- Specified by:
getSupportedCipherSuitesin classjavax.net.ssl.SSLSocketFactory
-
getDefaultProtocols
public java.lang.String[] getDefaultProtocols()
Returns the default protocols.- Returns:
- the default protocols
-
getSupportedProtocols
public java.lang.String[] getSupportedProtocols()
Returns the supported protocols.- Returns:
- the supported protocols
-
createSocket
public java.net.Socket createSocket(java.net.Socket s, java.lang.String host, int port, boolean autoClose) throws java.io.IOExceptionCreates an SSL Socket.
- Specified by:
createSocketin classjavax.net.ssl.SSLSocketFactory- Throws:
java.io.IOException
-
createSocket
public java.net.Socket createSocket(java.net.InetAddress address, int port, java.net.InetAddress localAddress, int localPort) throws java.io.IOExceptionCreates a new SSL Socket.
- Specified by:
createSocketin classjavax.net.SocketFactory- Throws:
java.io.IOException
-
createSocket
public java.net.Socket createSocket(java.lang.String host, int port, java.net.InetAddress localHost, int localPort) throws java.io.IOExceptionCreates a new SSL Socket.
- Specified by:
createSocketin classjavax.net.SocketFactory- Throws:
java.io.IOException
-
createSocket
public java.net.Socket createSocket(java.net.InetAddress host, int port) throws java.io.IOExceptionCreates a new SSL Socket.
- Specified by:
createSocketin classjavax.net.SocketFactory- Throws:
java.io.IOException
-
createSocket
public java.net.Socket createSocket(java.lang.String host, int port) throws java.io.IOExceptionCreates a new SSL Socket.
- Specified by:
createSocketin classjavax.net.SocketFactory- Throws:
java.io.IOException
-
getProtocolList
protected java.lang.String[] getProtocolList()
Returns the protocol list.- Returns:
- the protocol list
-
-