Skip to content

使用jdk21的时候,企业微信会话存档解密报错IllegalAccessError #3211

Description

@ideaviewes

简要描述

使用jdk21的时候,企业微信会话存档解密报错IllegalAccessError

模块版本情况

  • WxJava 模块名: wx-java-cp-multi-spring-boot-starter
  • WxJava 版本号: 4.6.0
  • Jdk 版本号 Oracle GraalVM 21.0.1+12.1
  • Springboot 版本号:3.2.1

详细描述

   @Resource
    private WxCpMultiServices wxCpMultiServices;
    @GetMapping("/")
    public WxCpChatDatas index(
            @RequestParam(value = "seq") Long seq
    ) throws Exception {
        WxCpService wxCpService = wxCpMultiServices.getWxCpService("niurensheji");
        WxCpMsgAuditService auditService = wxCpService.getMsgAuditService();

        WxCpChatDatas datas = auditService.getChatDatas(seq, 100, null, null, 1000);
        List<String> list=new ArrayList<>();
        List<WxCpChatDatas.WxCpChatData> data = datas.getChatData();
        Long sdk = datas.getSdk();
        for (WxCpChatDatas.WxCpChatData item : data) {
            String decryptData = auditService.getChatPlainText(sdk, item, 1);
            list.add(decryptData);
        }
        return datas;
    }

代码是这样的,解密的时候报的错,

日志

如果日志不多,直接使用md代码引用格式贴在此处,否则如果太长,请将日志放在 pastebin 或者其他地方,然后将其url地址贴在这里

日志请写于此处
Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Handler dispatch failed: java.lang.IllegalAccessError: class me.chanjar.weixin.cp.util.crypto.WxCpCryptUtil (in unnamed module @0x2d2e5f00) cannot access class sun.security.util.DerInputStream (in module java.base) because module java.base does not export sun.security.util to unnamed module @0x2d2e5f00] with root cause

java.lang.IllegalAccessError: class me.chanjar.weixin.cp.util.crypto.WxCpCryptUtil (in unnamed module @0x2d2e5f00) cannot access class sun.security.util.DerInputStream (in module java.base) because module java.base does not export sun.security.util to unnamed module @0x2d2e5f00
        at me.chanjar.weixin.cp.util.crypto.WxCpCryptUtil.decryptPriKeyByPKCS1(WxCpCryptUtil.java:108) ~[weixin-java-cp-4.6.0.jar!/:na]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions