use a preferable protocol that works on jvm 1.6

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
Rohit Yadav 2015-01-28 13:41:00 +05:30
parent 1ef12f4145
commit f5f6c2d1a7
3 changed files with 4 additions and 7 deletions

View File

@ -47,7 +47,7 @@ public class RabbitMQEventBus extends ManagerBase implements EventBus {
private static Integer port;
private static String username;
private static String password;
private static String secureProtocol = "TLSv1.2";
private static String secureProtocol = "TLSv1";
public static void setVirtualHost(String virtualHost) {
RabbitMQEventBus.virtualHost = virtualHost;

View File

@ -48,9 +48,6 @@ public class SocketWrapperImpl extends PipelineImpl implements SocketWrapper {
protected SSLSocket sslSocket;
protected String SSL_VERSION_TO_USE = "TLSv1.2";
//protected String SSL_VERSION_TO_USE = "SSLv3";
protected SSLState sslState;
public SocketWrapperImpl(String id, SSLState sslState) {
@ -135,7 +132,7 @@ public class SocketWrapperImpl extends PipelineImpl implements SocketWrapper {
// Use most secure implementation of SSL available now.
// JVM will try to negotiate TLS1.2, then will fallback to TLS1.0, if
// TLS1.2 is not supported.
SSLContext sslContext = SSLContext.getInstance(SSL_VERSION_TO_USE);
SSLContext sslContext = SSLUtils.getSSLContext();
// Trust all certificates (FIXME: insecure)
sslContext.init(null, new TrustManager[] {new TrustAllX509TrustManager(sslState)}, null);

View File

@ -42,10 +42,10 @@ public class SSLUtils {
}
public static SSLContext getSSLContext() throws NoSuchAlgorithmException {
return SSLContext.getInstance("TLSv1.2");
return SSLContext.getInstance("TLSv1");
}
public static SSLContext getSSLContext(String provider) throws NoSuchAlgorithmException, NoSuchProviderException {
return SSLContext.getInstance("TLSv1.2", provider);
return SSLContext.getInstance("TLSv1", provider);
}
}