This commit is contained in:
liulu 2024-11-14 17:23:38 +08:00
parent 5ce75ed4ce
commit 84aaa824c5
5 changed files with 14 additions and 15 deletions

View File

@ -31,7 +31,7 @@ public abstract class JnaSdfAdaptor implements SdfApiAdapter {
protected final SdfLibrary sdfLibrary;
protected abstract int getAlgId(String alg);
protected abstract int getAlgId(AlgId alg);
@Override
public String openDevice() {

View File

@ -2,6 +2,7 @@ package com.sunyard.chsm.sdf.adapter;
import com.sun.jna.Native;
import com.sun.jna.ptr.PointerByReference;
import com.sunyard.chsm.sdf.context.AlgId;
import com.sunyard.chsm.sdf.context.SunyardAlgId;
import com.sunyard.chsm.sdf.lib.SunyardSdfLibrary;
@ -50,8 +51,8 @@ public class SunyardJnaSdfAdaptor extends JnaSdfAdaptor {
}
@Override
protected int getAlgId(String alg) {
return SunyardAlgId.valueOf(alg).getValue();
protected int getAlgId(AlgId alg) {
return SunyardAlgId.valueOf(alg.name()).getValue();
}
public static byte[] safeStringBytes(String str) {

View File

@ -4,15 +4,15 @@ package com.sunyard.chsm.sdf.context;
* @author liulu
* @since 2024/11/5
*/
public interface AlgId {
public enum AlgId {
SGD_SM3,
String SGD_SM3 = "SGD_SM3";
SGD_SM4_CBC,
SGD_SM4_ECB,
SGD_SM4_MAC,
String SGD_SM4_CBC = "SGD_SMS4_CBC";
String SGD_SM4_ECB = "SGD_SMS4_ECB";
String SGD_SM4_MAC = "SGD_SMS4_MAC";
String SGD_SM2_1 = "SGD_SM2_1"; // 签名验签
String SGD_SM2_2 = "SGD_SM2_2";
String SGD_SM2_3 = "SGD_SM2_3"; // 加密解密
SGD_SM2_1,// 签名验签
SGD_SM2_2,
SGD_SM2_3,// 加密解密
;
}

View File

@ -6,7 +6,6 @@ import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.sun.jna.Pointer;
import com.sunyard.ssp.common.Result;
import com.sunyard.ssp.constv.Alg;
import com.sunyard.ssp.modules.monitor.log.entity.AuditLog;
@ -90,7 +89,6 @@ public class ScUShieldController {
@Autowired
private IParamConfService iParamConfService;
Pointer hDeviceHandle = null;
@Autowired
private SdkApiService sdkApiService;
ObjectMapper mapper = new ObjectMapper();

View File

@ -1,5 +1,5 @@
server:
port: 89
port: 8900
tomcat:
uri-encoding: UTF-8
threads: