mirror of
https://gitee.com/dromara/hutool.git
synced 2025-04-05 17:37:59 +08:00
fix sm2 bug
This commit is contained in:
parent
b4568dd2e3
commit
8102b31373
@ -12,6 +12,7 @@
|
||||
### Bug修复
|
||||
* 【json 】 修复解析JSON字符串时配置无法传递问题
|
||||
* 【core 】 修复ServletUtil.readCookieMap空指针问题(issue#827@Github)
|
||||
* 【crypto 】 修复SM2中检查密钥导致的问题(issue#I1EC47@Gitee)
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
@ -182,7 +182,6 @@ public class SM2 extends AbstractAsymmetricCrypto<SM2> {
|
||||
if (KeyType.PublicKey != keyType) {
|
||||
throw new IllegalArgumentException("Encrypt is only support by public key");
|
||||
}
|
||||
checkKey(keyType);
|
||||
return encrypt(data, new ParametersWithRandom(getCipherParameters(keyType)));
|
||||
}
|
||||
|
||||
@ -229,7 +228,6 @@ public class SM2 extends AbstractAsymmetricCrypto<SM2> {
|
||||
if (KeyType.PrivateKey != keyType) {
|
||||
throw new IllegalArgumentException("Decrypt is only support by private key");
|
||||
}
|
||||
checkKey(keyType);
|
||||
return decrypt(data, getCipherParameters(keyType));
|
||||
}
|
||||
|
||||
@ -450,26 +448,6 @@ public class SM2 extends AbstractAsymmetricCrypto<SM2> {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查对应类型的Key是否存在
|
||||
*
|
||||
* @param keyType key类型
|
||||
*/
|
||||
private void checkKey(KeyType keyType) {
|
||||
switch (keyType) {
|
||||
case PublicKey:
|
||||
if (null == this.publicKey) {
|
||||
throw new NullPointerException("No public key provided");
|
||||
}
|
||||
break;
|
||||
case PrivateKey:
|
||||
if (null == this.privateKey) {
|
||||
throw new NullPointerException("No private key provided");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取{@link SM2Engine},此对象为懒加载模式
|
||||
*
|
||||
|
@ -171,9 +171,7 @@ public class SM2Test {
|
||||
String id = "31323334353637383132333435363738";
|
||||
|
||||
final SM2 sm2 = new SM2(d, x, y);
|
||||
|
||||
final String sign = sm2.signHex(data, id);
|
||||
|
||||
Assert.assertTrue(sm2.verifyHex(data, sign));
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,8 @@
|
||||
package cn.hutool.poi.excel;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import org.apache.poi.hssf.usermodel.HSSFClientAnchor;
|
||||
import org.apache.poi.hssf.usermodel.HSSFPicture;
|
||||
import org.apache.poi.hssf.usermodel.HSSFPictureData;
|
||||
@ -20,9 +19,9 @@ import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTMarker;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Excel图片工具类
|
||||
@ -87,7 +86,7 @@ public class ExcelPicUtil {
|
||||
* @return 图片映射,键格式:行_列,值:{@link PictureData}
|
||||
*/
|
||||
private static Map<String, PictureData> getPicMapXlsx(XSSFWorkbook workbook, int sheetIndex) {
|
||||
final Map<String, PictureData> sheetIndexPicMap = new HashMap<String, PictureData>();
|
||||
final Map<String, PictureData> sheetIndexPicMap = new HashMap<>();
|
||||
final XSSFSheet sheet = workbook.getSheetAt(sheetIndex);
|
||||
XSSFDrawing drawing;
|
||||
for (POIXMLDocumentPart dr : sheet.getRelations()) {
|
||||
|
Loading…
Reference in New Issue
Block a user