This commit is contained in:
liulu
2024-12-13 15:00:10 +08:00
parent 8f997d2a00
commit 0a8c49f533
6 changed files with 172 additions and 25 deletions
@@ -80,9 +80,9 @@ public interface SdfApiService {
* @param userId 签名者id
* @return pucSignature 返回签名值数据
*/
EccSignature externalSignWithId(byte[] privateKey, byte[] pucData, byte[] userId);
EccSignature externalSignWithIdECC(byte[] privateKey, byte[] pucData, byte[] userId);
EccSignature externalSign(byte[] privateKey, byte[] pucData);
EccSignature externalSignECC(byte[] privateKey, byte[] pucData);
/**
* 外部密钥ECC验证
@@ -93,9 +93,9 @@ public interface SdfApiService {
* @param signData 外部签名数据
* @return 0 成功; 非0 失败,返回错误代码
*/
boolean externalVerifyWithId(byte[] publicKey, byte[] pubData, byte[] signData, byte[] userId);
boolean externalVerifyWithIdECC(byte[] publicKey, byte[] pubData, byte[] signData, byte[] userId);
boolean externalVerify(byte[] publicKey, byte[] pubData, byte[] signData);
boolean externalVerifyECC(byte[] publicKey, byte[] pubData, byte[] signData);
/**
@@ -105,7 +105,7 @@ public interface SdfApiService {
* @param pucData 缓冲区指针,用于存放外部输入的数据
* @return pucEncData 返回数据密文
*/
EccCipher externalEncrypt(byte[] publicKey, byte[] pucData);
EccCipher externalEncryptECC(byte[] publicKey, byte[] pucData);
/**
* 外部密钥ECC私钥解密
@@ -114,7 +114,7 @@ public interface SdfApiService {
* @param encData 缓冲区指针,用于存放输入的数据密文
* @return pucData 返回数据明文
*/
byte[] externalDecrypt(byte[] privateKey, byte[] encData);
byte[] externalDecryptECC(byte[] privateKey, byte[] encData);
/**
* 计算MAC
@@ -269,7 +269,7 @@ public abstract class JnaSdfAdaptor implements SdfApiAdapter {
public int hashInit(String sessionHandle, AlgId alg, EccPubKey pucPublicKey, byte[] pucID) {
Pointer hSessionHandle = getSessionHandle(sessionHandle);
byte[] pubPub = pucPublicKey == null ? null : pucPublicKey.toSdfData();
return sdfLibrary.SDF_HashInit(hSessionHandle, getAlgId(AlgId.SGD_SM3), pubPub, pucID, pucID.length);
return sdfLibrary.SDF_HashInit(hSessionHandle, getAlgId(AlgId.SGD_SM3), pubPub, pucID, pucID == null ? 0 : pucID.length);
}
@Override