金山WPS在线编辑

This commit is contained in:
zhangqinbin
2023-10-24 16:24:34 +08:00
parent 5b23ee8844
commit 82802f25c0

View File

@ -530,22 +530,28 @@ public class WpsServiceImpl implements WpsService {
String mdKey = MdConstants.getSha256(time+fileId+appName+token); String mdKey = MdConstants.getSha256(time+fileId+appName+token);
log.info("mdKey:"+mdKey); log.info("mdKey:"+mdKey);
//fileId|token|yyyyMMddHHmmss|md5加密 //fileId|token|yyyyMMddHHmmss|md5加密
String rsaKey = fileId+"|"+token+"|"+time+"|"+mdKey; String rsaKey = fileId+"|"+token+"|"+time;
log.info("rsaKey:"+rsaKey); log.info("rsaKey:"+rsaKey);
//RSA加密 //RSA加密
String key = RSA.encrypt(rsaKey,kswpublicKey); String key = RSA.encrypt(rsaKey,kswpublicKey);
log.info("key:"+key); log.info("key:"+key);
return key; return key+"|"+mdKey;
} }
private String downloadDecrypt(String key){ 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 fileId = value[0];
String token = value[1]; String token = value[1];
String time = value[2]; String time = value[2];
String md = value[3];
String o_key = MdConstants.getSha256(time+fileId+appName+token);// String o_key = MdConstants.getSha256(time+fileId+appName+token);//