TLSv1.2를 사용하여 서버와 RabbitMQ 연결을 만들려고하는데 java.net.SocketException이 있습니다. 연결 재설정 또는 javax.net.ssl.SSLHandshakeException : 치명적인 경고 수신 : handshake_failure (이 예외가 변경되는 것처럼 보입니다. 무작위로).왜 내 rabbitMQ 클라이언트에 연결할 수 없습니까?
내가 TLSv1.0을 가졌을 때 작동했지만 서버가 프로토콜을 변경하면 작동이 중지되었습니다 (동일한 암호, 포트 등을 사용하더라도).
vhost/기타 연결 매개 변수가 잘못된 경우이 예외를 얻을 수 있습니까?
연결하기 전에, 내가하고 있어요 :
public ConnectionFactory get() throws IOException, KeyStoreException, NoSuchAlgorithmException,
CertificateException, UnrecoverableKeyException, KeyManagementException, URISyntaxException {
final ConnectionFactory cf = new ConnectionFactory();
final SSLContext sslContext = getSSLContext();
cf.useSslProtocol(sslContext);
final ConnectionSettings connectionSettings = getConnectionSettings(sslContext.getSocketFactory());
cf.setHost(connectionSettings.getHost());
cf.setPort(connectionSettings.getPort());
cf.setVirtualHost(connectionSettings.getVirtualHost());
//using cf.setUsername and cs.setPassword doesn't work
cf.setSaslConfig(DefaultSaslConfig.EXTERNAL);
cf.setAutomaticRecoveryEnabled(false);
cf.setTopologyRecoveryEnabled(false);
return cf;
}
그리고 getSSLContext() 메소드 : 여기
System.setProperty("https.protocols", "TLSv1.2");
내 구성입니다 난 때
private SSLContext getSSLContext(){
//SECURE_PROTOCOLE = "TLSv1.2"
final SSLContext sslContext = SSLContext.getInstance(SECURE_PROTOCOLE);
KeyStore keystore = KeyStore.getInstance("Windows-MY");
keystore.load(null, null);
final KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
kmf.init(keystore, null);
TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
return null;
}
@Override
public void checkClientTrusted(X509Certificate[] arg0, String arg1) throws CertificateException {
// Not implemented
}
@Override
public void checkServerTrusted(X509Certificate[] arg0, String arg1) throws CertificateException {
// Not implemented
}
} };
sslContext.init(keyManagerWrapper(kmf),
trustAllCerts, new SecureRandom());
return sslContext;
}
예외가 발생 새 연결을 만들려고합니다.
this.connectionFactory = new ConnectionFactoryProvider().get();
this.connection = this.connectionFactory.newConnection();