GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — 【企业微信】修复 sun.security.util 在高版本 java 中无法访问的问题,改为通过 bouncycastle 库解析私钥 by Demonese · Pull Request #3216 · binarywang/WxJava

Conversation

@Demonese

@Demonese Demonese commented Jan 12, 2024

Copy link
Copy Markdown

注意:该解决方法会额外为 cp 模块引入新的依赖库,如果有更好的写法欢迎提出。
相关 issue:#3211

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
璀境石 璀境石
【企业微信】修复 sun.security.util 在高版本 java 中无法访问的问题,改为通过 bouncycastle 库解析私钥
0105d5a
@binarywang binarywang linked an issue Jan 12, 2024 that may be closed by this pull request
使用jdk21的时候,企业微信会话存档解密报错IllegalAccessError #3211
Closed
@binarywang
binarywang merged commit 5fad646 into binarywang:develop Jan 12, 2024
@binarywang binarywang added this to the 4.6.1 milestone Mar 2, 2024
borisbao pushed a commit to borisbao/WxJava that referenced this pull request Mar 23, 2024
璀境石 boris.bao
🎨 binarywang#3216 【企业微信】修复 sun.security.util 在高版本 java 中无法访问的问题,改为通过 …
2f133f8
…bouncycastle 库解析私钥
@7757

7757 commented Jun 6, 2024

Copy link
Copy Markdown

目前版本是4.6.0

为什么跟pr的不一致呢

public static String decryptPriKeyByPKCS1(String encryptRandomKey, String msgAuditPriKey) throws Exception { String privateKey = msgAuditPriKey.replaceAll("(\r\n|\r|\n|\n\r)", "").replace("-----BEGIN RSA PRIVATE KEY-----", "").replace("-----END RSA PRIVATE KEY-----", "").replace(" ", ""); byte[] keyBytes = Base64.getDecoder().decode(privateKey); DerValue[] seq = (new DerInputStream(keyBytes)).getSequence(0); RSAPrivateCrtKeySpec keySpec = new RSAPrivateCrtKeySpec(seq[1].getBigInteger(), seq[2].getBigInteger(), seq[3].getBigInteger(), seq[4].getBigInteger(), seq[5].getBigInteger(), seq[6].getBigInteger(), seq[7].getBigInteger(), seq[8].getBigInteger()); PrivateKey priKey = KeyFactory.getInstance("RSA").generatePrivate(keySpec); Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding"); cipher.init(2, priKey); byte[] utf8 = cipher.doFinal(Base64.getDecoder().decode(encryptRandomKey)); return new String(utf8, StandardCharsets.UTF_8); }

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@7757

7757 commented Jun 6, 2024

Copy link
Copy Markdown

目前版本是4.6.0

为什么跟pr的不一致呢

public static String decryptPriKeyByPKCS1(String encryptRandomKey, String msgAuditPriKey) throws Exception { String privateKey = msgAuditPriKey.replaceAll("(\r\n|\r|\n|\n\r)", "").replace("-----BEGIN RSA PRIVATE KEY-----", "").replace("-----END RSA PRIVATE KEY-----", "").replace(" ", ""); byte[] keyBytes = Base64.getDecoder().decode(privateKey); DerValue[] seq = (new DerInputStream(keyBytes)).getSequence(0); RSAPrivateCrtKeySpec keySpec = new RSAPrivateCrtKeySpec(seq[1].getBigInteger(), seq[2].getBigInteger(), seq[3].getBigInteger(), seq[4].getBigInteger(), seq[5].getBigInteger(), seq[6].getBigInteger(), seq[7].getBigInteger(), seq[8].getBigInteger()); PrivateKey priKey = KeyFactory.getInstance("RSA").generatePrivate(keySpec); Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding"); cipher.init(2, priKey); byte[] utf8 = cipher.doFinal(Base64.getDecoder().decode(encryptRandomKey)); return new String(utf8, StandardCharsets.UTF_8); }

sorry 之前用的是4.6.0

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

4.6.1

Development

Successfully merging this pull request may close these issues.

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

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@Demonese @7757 @binarywang
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.