You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用pysnmp解密SNMP V3 Trap时遇解密错误求助

SNMPv3 Trap pysnmp解码失败问题

问题现象

  • 通过tcpdump抓取的Trap消息,使用Wireshark可正常接收并解码
  • 使用pysnmp库接收时触发以下错误:
2023-04-11 11:55:54,792 pysnmp: processIncomingMsg: scopedPDU decoder failed <class 'pyasn1.error.SubstrateUnderrunError'>
2023-04-11 11:55:54,792 pysnmp: StatusInformation: {'errorIndication': DecryptionError('Ciphering services not available or ciphertext is broken'), 'msgUserName': <OctetString value object, tagSet <TagSet object, tags 0:0:4>, subtypeSpec <ConstraintsIntersection object, consts <ValueSizeConstraint object, consts 0, 32>>, encoding iso-8859-1, payload [user1]>}
2023-04-11 11:55:54,792 pysnmp: prepareDataElements: SM failed, statusInformation {'errorIndication': DecryptionError('Ciphering services not available or ciphertext is broken'), 'msgUserName': <OctetString value object, tagSet <TagSet object, tags 0:0:4>, subtypeSpec <ConstraintsIntersection object, consts <ValueSizeConstraint object, consts 0, 32>>, encoding iso-8859-1, payload [user1]>}

当前依赖包版本

bcrypt                         3.2.0
certifi                        2022.12.7
cffi                           1.14.4
cryptography                   38.0.1
netmiko                        3.2.0
paramiko                       2.7.2
pip                            23.0.1
ply                            3.11
pyasn1                         0.4.8
pycparser                      2.20
pycrypto                       2.6.1
pycryptodomex                  3.15.0
pylzma                         0.5.0
PyNaCl                         1.4.0
pyOpenSSL                      22.1.0
pyserial                       3.5
pysmi                          0.3.4
pysnmp                         4.4.12
PySocks                        1.7.1
python-dateutil                2.8.1
pytz                           2020.4
pyvmomi                        8.0.0.1.2
PyYAML                         5.3.1

已尝试的解决方案

  • 排查Python3虚拟环境下pysnmp使用SNMPv3时的“加密服务不可用”相关修复方案
  • 执行python -c 'from Cryptodome.Cipher import AES'验证PyCryptodome的AES模块可用性
  • 安装pycrypto后重新尝试接收Trap消息

内容的提问来源于stack exchange,提问作者dayanandColt

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.25 04:42:48