金山WPS在线编辑

This commit is contained in:
zhangqinbin
2023-10-24 16:06:21 +08:00
parent aa5d4a6b0c
commit 5b23ee8844
2 changed files with 6 additions and 1 deletions

View File

@ -1,6 +1,7 @@
package com.chinaunicom.mall.ebtp.extend.shortmessage.utils; package com.chinaunicom.mall.ebtp.extend.shortmessage.utils;
import com.chinaunicom.mall.ebtp.common.exception.common.CommonExceptionEnum; import com.chinaunicom.mall.ebtp.common.exception.common.CommonExceptionEnum;
import lombok.extern.slf4j.Slf4j;
import javax.crypto.Cipher; import javax.crypto.Cipher;
import java.security.*; import java.security.*;
@ -11,7 +12,7 @@ import java.security.spec.X509EncodedKeySpec;
import java.util.Base64; import java.util.Base64;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@Slf4j
public class RSA { public class RSA {
public static final String KEY_ALGORITHM = "RSA"; public static final String KEY_ALGORITHM = "RSA";
@ -272,6 +273,7 @@ public class RSA {
String v = encryptBASE64(RSA.encryptByPublicKey(value.getBytes(), publicKey)); String v = encryptBASE64(RSA.encryptByPublicKey(value.getBytes(), publicKey));
return v; return v;
}catch (Exception e){ }catch (Exception e){
log.error("加密异常",e);
CommonExceptionEnum.FRAME_EXCEPTION_COMMON_DATA_OTHER_ERROR.customValidName("加密异常", true); CommonExceptionEnum.FRAME_EXCEPTION_COMMON_DATA_OTHER_ERROR.customValidName("加密异常", true);
} }
return ""; return "";

View File

@ -528,10 +528,13 @@ public class WpsServiceImpl implements WpsService {
String time = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")); String time = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"));
//fileId+ebtp+token+time md5加密 //fileId+ebtp+token+time md5加密
String mdKey = MdConstants.getSha256(time+fileId+appName+token); String mdKey = MdConstants.getSha256(time+fileId+appName+token);
log.info("mdKey:"+mdKey);
//fileId|token|yyyyMMddHHmmss|md5加密 //fileId|token|yyyyMMddHHmmss|md5加密
String rsaKey = fileId+"|"+token+"|"+time+"|"+mdKey; String rsaKey = fileId+"|"+token+"|"+time+"|"+mdKey;
log.info("rsaKey:"+rsaKey);
//RSA加密 //RSA加密
String key = RSA.encrypt(rsaKey,kswpublicKey); String key = RSA.encrypt(rsaKey,kswpublicKey);
log.info("key:"+key);
return key; return key;
} }