首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法通过python 3的pymqi版本使用SSL连接到公共队列

无法通过python 3的pymqi版本使用SSL连接到公共队列
EN

Stack Overflow用户
提问于 2020-03-12 14:37:38
回答 1查看 886关注 0票数 1

我使用下面的python代码与Python2的旧版本pymqi建立了到公共队列的连接:

代码语言:javascript
复制
import logging

import pymqi

logging.basicConfig(level=logging.INFO)

queue_manager = 'QM1'
channel = 'BZU.UAT.CHNL'
host = '245.274.46.56'
port = '1416'
queue_name = 'BZU.UAT.QUEUE'
conn_info = '%s(%s)' % (host, port)
ssl_cipher_spec = 'TLS_RSA_WITH_3DES_EDE_CBC_SHA'
key_repo_location = 'D:\\App\\BZU\\keydb\\key'
message = 'Hello from Python!'

cd = pymqi.CD()
cd.ChannelName = channel
cd.ConnectionName = conn_info
cd.ChannelType = pymqi.CMQC.MQCHT_CLNTCONN
cd.TransportType = pymqi.CMQC.MQXPT_TCP
cd.SSLCipherSpec = ssl_cipher_spec
cd.UserIdentifier = 'BZU'
cd.Password = ''

sco = pymqi.SCO()
sco.KeyRepository = key_repo_location

qmgr = pymqi.QueueManager(None)
qmgr.connect_with_options(queue_manager, cd, sco)

put_queue = pymqi.Queue(qmgr, queue_name)
put_queue.put(message)

get_queue = pymqi.Queue(qmgr, queue_name)
logging.info('Here is the message again: [%s]' % get_queue.get())

put_queue.close()
get_queue.close()
qmgr.disconnect()

不幸的是,此代码不适用于Python 3的pymqi版本1.9.3。

代码语言:javascript
复制
Traceback (most recent call last):
  File ".\mq_conn_with_ssl.py", line 33, in <module>
    qmgr.connect_with_options(queue_manager, cd, sco)
  File "D:\App\BZU\arn-basis-common\py\pymqi\__init__.py", line 1347, in connect_with_options
    raise MQMIError(rv[1], rv[2])
pymqi.MQMIError: MQI Error. Comp: 2, Reason 2393: FAILED: MQRC_SSL_INITIALIZATION_ERROR

我必须将这段代码中的所有字符串转换为字节,因为程序要求所有字符串都是字节。示例:

queue_manager = b'QM1‘

在您声明的注释中,您在AMQERR01.LOG文件中发现了以下错误:

代码语言:javascript
复制
AMQ9716: Remote SSL certificate revocation status check failed for channel 'BZU.UAT.CHNL'.
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-03-12 18:13:25

比较工作服务器上的mqclient.ini文件和非工作服务器上的SSL:节中的差异,这将解释OCSP检查失败的原因。

mqclient.ini文件的位置可以在IBM知识中心页面IBM MQ>Configuring>Configuring connections between the server and clients>Configuring a client using a configuration file>Location of the client configuration file中找到。见下文摘要:

环境变量MQCLNTCF.

  • A文件(称为mqclient.ini )在application.

  • A文件的当前工作目录中指定的位置,该文件名为mqclient.ini,位于IBM数据目录中,用于Windows和Linux系统。

关于SSL节的mqclient.ini文档可以在IBM知识中心页面IBM MQ>Configuring>Configuring connections between the server and clients>Configuring a client using a configuration file>SSL stanza of the client configuration file中找到。见下文摘要:

OCSPAuthentication =可选的REQUIRED \x{e76f}警告

OCSPCheckExtensions = YES \x\x{e76f}没有

SSLHTTPProxyName = string

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60656346

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档