java - 没有合适的协议(protocol)(协议(protocol)被禁用或密码套件不合适)

标签 java ssl ibm-mq

我正在尝试创建与启用了 ssl 身份验证的 mq 管理器的连接。我正在使用 Java 1.8

我有这个代码

TrustStrategy trustStrategy = new TrustSelfSignedStrategy();
KeyStore trustStore = KeyStore.getInstance("JKS");
try (FileInputStream fileInputStream = new FileInputStream(propertyReader.getProperty(QUEUE_KEYSTORE))) {
trustStore.load(fileInputStream, propertyReader.getProperty(QUEUE_KEYSTOREPASS).toCharArray());
}
KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
kmf.init(trustStore, "changeit".toCharArray());
final TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
tmf.init(trustStore);

final SSLContext sslContext = SSLContext.getInstance("TLSv1.2");
sslContext.init(kmf.getKeyManagers(), tmf.getTrustManagers(), new SecureRandom());

connectionFactory.setTransportType(WMQConstants.WMQ_CM_CLIENT);
connectionFactory.setHostName(propertyReader.getProperty(QUEUE_HOST));
connectionFactory.setQueueManager(propertyReader.getProperty(QUEUE_MANAGER));
connectionFactory.setChannel(propertyReader.getProperty(QUEUE_CHANNEL));
connectionFactory.setSSLCipherSuite(propertyReader.getProperty(QUEUE_CIPHERSUITE));
connectionFactory.setPort(Integer.parseInt(propertyReader.getProperty(QUEUE_PORT)));
connectionFactory.setSSLSocketFactory(sslContext.getSocketFactory());

当我尝试创建连接时,我得到了 异常 :
com.ibm.mq.MQException: MQJE001: Completion Code 2, Reason 2397
javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)

我可以在 中看到以下内容日志 :
Allow unsafe renegotiation: false
Allow legacy hello messages: true
Is initial handshake: true
Is secure renegotiation: false
Ignoring unsupported cipher suite: TLS_RSA_WITH_AES_256_CBC_SHA256 for TLSv1
No available cipher suite for TLSv1
handling exception: javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
SEND TLSv1.2 ALERT:  fatal, description = handshake_failure
WRITE: TLSv1.2 Alert, length = 2
[Raw write]: length = 7
0000: 15 03 03 00 02 02 28                               ......(
called closeSocket()

这是说它仍在尝试使用 TLSv1 而不是 TLCv1.2?
我的安全文件中启用了 jce 无限强度。

更新详细信息:

IBM MQ Jar 版本:6.0.2.5

java版本“1.8.0_201”

Java(TM) SE 运行时环境 (build 1.8.0_201-b26)

最佳答案

您已声明您正在使用来自 v6.0.2.5 的 IBM MQ jar 文件,这在 2012 年 9 月 30 日失去了 IBM 的支持。有关该旧版本支持的唯一 CipherSuites 的更多详细信息,请参阅此问题的结尾。

您可以使用 Maven 在以下链接中获取当前的 IBM MQ v9.1.0.4 LTS 支持客户端:

MVN REPOSITORY » com.ibm.mq com.ibm.mq.allclient

我检查了保存为 PDF 和 MQ v6 的旧文档仅支持 SSL 和 TLS1.0 密码,列表如下:

SSL_RSA_WITH_NULL_MD5
SSL_RSA_WITH_NULL_SHA
SSL_RSA_EXPORT_WITH_RC4_40_MD5
SSL_RSA_WITH_RC4_128_MD5
SSL_RSA_WITH_RC4_128_SHA
SSL_RSA_EXPORT_WITH_RC2_CBC_40_MD5
SSL_RSA_WITH_DES_CBC_SHA
SSL_RSA_EXPORT1024_WITH_RC4_56_SHA
SSL_RSA_EXPORT1024_WITH_DES_CBC_SHA
SSL_RSA_WITH_3DES_EDE_CBC_SHA
SSL_RSA_WITH_AES_128_CBC_SHA
SSL_RSA_WITH_AES_256_CBC_SHA
SSL_RSA_WITH_DES_CBC_SHA
SSL_RSA_WITH_3DES_EDE_CBC_SHA
SSL_RSA_FIPS_WITH_DES_CBC_SHA
SSL_RSA_FIPS_WITH_3DES_EDE_CBC_SHA

关于java - 没有合适的协议(protocol)(协议(protocol)被禁用或密码套件不合适),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60654644/

相关文章:

java - Java 7 的 SSL 连接失败

php - cURL SSL 请求失败

WCF/Web 服务充当 MQ 消息的监听器?

Java程序自动调用电话卡电话号码,输入卡号时出现问题

java - JBoss焊接: Inject different implementation for testing

wcf - 如何使用 Let's Encrypt 生成用于 WCF 休息服务的证书?

ibm-mq - 在 Websphere MQ 中重命名队列

ibm-mq - 使用 MQ 服务对象运行 OS 命令 - AMQ8734 - 命令失败 - 程序无法启动

java - 如何在 Android 应用程序中全局访问另一个类的 Activity?

java - Hibernate 急切地加载惰性引用