From 5b23ee884412653e2827b5e97f1aa2a0eb1e22b9 Mon Sep 17 00:00:00 2001 From: zhangqinbin <181961702@qq.com> Date: Tue, 24 Oct 2023 16:06:21 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=91=E5=B1=B1WPS=E5=9C=A8=E7=BA=BF?= =?UTF-8?q?=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chinaunicom/mall/ebtp/extend/shortmessage/utils/RSA.java | 4 +++- .../mall/ebtp/extend/wps/service/impl/WpsServiceImpl.java | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/shortmessage/utils/RSA.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/shortmessage/utils/RSA.java index 4fe3e5d..a5fddca 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/shortmessage/utils/RSA.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/shortmessage/utils/RSA.java @@ -1,6 +1,7 @@ package com.chinaunicom.mall.ebtp.extend.shortmessage.utils; import com.chinaunicom.mall.ebtp.common.exception.common.CommonExceptionEnum; +import lombok.extern.slf4j.Slf4j; import javax.crypto.Cipher; import java.security.*; @@ -11,7 +12,7 @@ import java.security.spec.X509EncodedKeySpec; import java.util.Base64; import java.util.HashMap; import java.util.Map; - +@Slf4j public class RSA { public static final String KEY_ALGORITHM = "RSA"; @@ -272,6 +273,7 @@ public class RSA { String v = encryptBASE64(RSA.encryptByPublicKey(value.getBytes(), publicKey)); return v; }catch (Exception e){ + log.error("加密异常",e); CommonExceptionEnum.FRAME_EXCEPTION_COMMON_DATA_OTHER_ERROR.customValidName("加密异常", true); } return ""; diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/wps/service/impl/WpsServiceImpl.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/wps/service/impl/WpsServiceImpl.java index 0c0c09c..ae933fa 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/wps/service/impl/WpsServiceImpl.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/wps/service/impl/WpsServiceImpl.java @@ -528,10 +528,13 @@ public class WpsServiceImpl implements WpsService { String time = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")); //fileId+ebtp+token+time md5加密 String mdKey = MdConstants.getSha256(time+fileId+appName+token); + log.info("mdKey:"+mdKey); //fileId|token|yyyyMMddHHmmss|md5加密 String rsaKey = fileId+"|"+token+"|"+time+"|"+mdKey; + log.info("rsaKey:"+rsaKey); //RSA加密 String key = RSA.encrypt(rsaKey,kswpublicKey); + log.info("key:"+key); return key; }