Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
【企业微信】优化会话存档CRLF替换支持
  • Loading branch information
0katekate0 committed Aug 11, 2022
commit a6b8b1d247b134bc2ca03494f31a7306361583f6
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package me.chanjar.weixin.cp.util.crypto;

import com.google.common.io.BaseEncoding;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.util.crypto.WxCryptUtil;
import me.chanjar.weixin.cp.config.WxCpConfigStorage;
Expand Down Expand Up @@ -61,7 +60,7 @@ public static String decryptPriKey(String encryptRandomKey, String msgAuditPriKe
* @throws Exception
*/
public static String decryptPriKeyByPKCS8(String encryptRandomKey, String msgAuditPriKey) throws Exception {
String privateKey = msgAuditPriKey.replaceAll("\\n", "")
String privateKey = msgAuditPriKey.replaceAll("(\r\n|\r|\n|\n\r)", "")
.replace("-----BEGIN PRIVATE KEY-----", "")
.replace("-----END PRIVATE KEY-----", "")
.replaceAll(" ", "");
Expand All @@ -87,7 +86,7 @@ public static String decryptPriKeyByPKCS8(String encryptRandomKey, String msgAud
* @throws Exception
*/
public static String decryptPriKeyByPKCS1(String encryptRandomKey, String msgAuditPriKey) throws Exception {
String privateKey = msgAuditPriKey.replaceAll("\\n", "")
String privateKey = msgAuditPriKey.replaceAll("(\r\n|\r|\n|\n\r)", "")
.replace("-----BEGIN RSA PRIVATE KEY-----", "")
.replace("-----END RSA PRIVATE KEY-----", "")
.replaceAll(" ", "");
Expand Down