gpt4 book ai didi

Java 连接到 WMQ 8

转载 作者:行者123 更新时间:2023-11-30 02:35:35 25 4
gpt4 key购买 nike

我正在尝试将现有的 Java 应用程序连接到 WebSphere MQ 8。这在过去适用于其他版本的 Java 和 WMQ,但对于 Java 8 和 WMQ8,这不起作用。我得到:

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
called closeSocket()
Exception in thread "main" com.ibm.mq.MQException: MQJE001: Completion Code '2', Reason '2397'.

我只是不明白为什么会发生这种情况。我已经设置了各种 javax.net.ssl 参数。我使用我创建的适当的 SSL_TRUSTSTORE 和 KEYSTORE。拥有 SSL_CIPHERSUITE。

我已经尝试了(几乎)WMQ 支持的所有记录的 CipherSuites;我正在研究整个列表,设置和环境如下:

  1. JAVA SSL_CIPHERSUITE = SSL_RSA_WITH_AES_256_CBC_SHA
  2. WMQ channel SSL_CIPHERSUITE = TLS_RSA_WITH_AES_256_CBC_SHA
  3. MQ Client 7.0.0.1 - 我已尝试切换到 MQ Client 8,但没有任何改进
  4. IBM WebSphere MQ,版本:8.0.0.5
  5. AMQERR01.log 中没有与客户端错误对应的内容
  6. Oracle Java 8 (Java(TM) SE 运行时环境(版本 1.8.0_60-b27))-- 启用 SSLv3(已更改 jdk.tls.disabledAlgorithms=RC4,DH keySize < 768)

其他信息:

  • 客户(银行)正在使用 MQ 7,所以我没有选择无论他们使用哪种 QM。但我一直在本地使用 MQ 8 进行测试,以检查这是否是问题的一部分。
  • 我尝试过:-Dcom.ibm.mq.cfg.useIBMCipherMappings=false
  • 使用来自 Oracle 的 JCE 无限强度管辖权策略文件。

最佳答案

MQ v7.0 于 2008 年 6 月 27 日发布(修订包 7.0.0.1 于 2009 年 1 月 20 日相关),自 2015 年 9 月 30 日起不再支持(超过 1.5 年)。根据我下面的回答,此版本的 MQ 将不支持 Oracle JRE 上的 TLS CipherSuites,虽然您可以更新到更高版本的修复包,但我强烈建议您迁移到受支持的 MQ 客户端版本。较新的 MQ 客户端版本可以连接到较旧的 MQ 队列管理器。您可以通过以下链接下载 MQ 8.0 或 MQ 9.0 jar 文件的仅 java 安装:

<小时/>

APAR IV66840添加了新功能,允许非 IBM Java 运行时环境的用户使用 TLS CipherSuites。

对于 v7.0,这包含在 Fix Pack 7.0.1.13 中(请注意,Fix Pack 7.0.1.14 是该版本的最终版本)。

对于 8.0,这包含在 Fix Pack 8.0.0.2 中。

注意:此 APAR 是客户端修复。

要启用此选项,您需要执行以下操作:

To enable these non-default mappings for non-IBM runtime environments, the following Java System Property:

com.ibm.mq.cfg.useIBMCipherMappings

must be set to the value:

false

For example, this can be configured by using the JVM argument:

-Dcom.ibm.mq.cfg.useIBMCipherMappings=false

然后,您需要将 Oracle JRE 的 CipherSuite 指定为 TLS_RSA_WITH_AES_256_CBC_SHA,请注意,SSL_RSA_WITH_AES_256_CBC_SHA 是 IBM JRE CipherSuite 名称。

<小时/>

完成上述操作后,您可能会遇到 AMQ9771, 2393 SSL 初始化错误。

dW 回答帖子“Why do I get AMQ9771, 2393 SSL Initialization error from a MQ Java/JMS application when trying to use an TLS AES 256 cipher?”。它指出以下内容:

In this case, the issue is caused by attempting to use AES 256 strong cipher algorithms.

Most Java JREs, including Oracle/Sun and IBM's have Import Limits on Cryptographic Algorithms enabled. This limits the maximum key sizes and also some algorithms.

When trying to use a AES 256 cipher, such as ECDHE_RSA_AES_256_CBC_SHA384 or TLS_RSA_WITH_AES_256_CBC_SHA256 with a MQ Java/JMS application, you need to ensure your JRE supports this cipher. In most cases, when the stronger cipher algorithms are needed, such as AES 256 ciphers, the JCE Unlimited Strength Jurisdiction Policy Files must be obtained and installed in the JDK/JRE.

This is noted in the JDK/JRE documentation: For Oracle 1.7:

http://docs.oracle.com/javase/7/docs/technotes/guides/security/SunProviders.html

上面的预言机网站链接指出:

If stronger algorithms are needed (for example, AES with 256-bit keys), the JCE Unlimited Strength Jurisdiction Policy Files must be obtained and installed in the JDK/JRE.

It is the user's responsibility to verify that this action is permissible under local regulations.

如果您确实获得了 2393,请按照上述建议获取并安装JCE 无限强度管辖权策略文件

关于Java 连接到 WMQ 8,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43194227/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com