From 82802f25c0c3bb3513799aff678448bcf3f0b339 Mon Sep 17 00:00:00 2001 From: zhangqinbin <181961702@qq.com> Date: Tue, 24 Oct 2023 16:24:34 +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 --- .../extend/wps/service/impl/WpsServiceImpl.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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 ae933fa..e0d5776 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 @@ -530,22 +530,28 @@ public class WpsServiceImpl implements WpsService { String mdKey = MdConstants.getSha256(time+fileId+appName+token); log.info("mdKey:"+mdKey); //fileId|token|yyyyMMddHHmmss|md5加密 - String rsaKey = fileId+"|"+token+"|"+time+"|"+mdKey; + String rsaKey = fileId+"|"+token+"|"+time; log.info("rsaKey:"+rsaKey); //RSA加密 String key = RSA.encrypt(rsaKey,kswpublicKey); log.info("key:"+key); - return key; + return key+"|"+mdKey; } private String downloadDecrypt(String key){ - String[] value = RSA.decrypt(key,kswprivateKey).split("|"); + CommonExceptionEnum.FRAME_EXCEPTION_COMMON_DATA_OTHER_ERROR.customValidName("令牌无效",key.indexOf("|")<0); + + String[] k = key.split("|"); + String md = k[1]; + String val = RSA.decrypt(k[0],kswprivateKey); + CommonExceptionEnum.FRAME_EXCEPTION_COMMON_DATA_OTHER_ERROR.customValidName("令牌无效",val.indexOf("|")<0); + + String[] value = val.split("|"); String fileId = value[0]; String token = value[1]; String time = value[2]; - String md = value[3]; String o_key = MdConstants.getSha256(time+fileId+appName+token);//