1、添加签名验签接口,外部hash不带公钥。2、修改dproto依赖的版本
This commit is contained in:
@@ -228,6 +228,24 @@ interface SydDetachedSVApi {
|
||||
String publicKey,
|
||||
String sign);
|
||||
|
||||
/**
|
||||
* 通过指定的私钥对指定的原始数据编制带公钥证书的数字签名(遵循PKCS#7)
|
||||
* 待签名的原始数据将在接口内部进行不带公钥的 sm3 ,然后做 Detach 签名
|
||||
* @param orgData 待签名的原始数据
|
||||
* @param sCertDN 签名者证书 DN
|
||||
* @return 签名数据
|
||||
*/
|
||||
String sm3WithoutPKDetachedSign(byte[] orgData, String sCertDN);
|
||||
|
||||
/**
|
||||
* 对指定的原始数据核验其带公钥证书签名(PKCS#7)
|
||||
* 原始数据将在接口内部进行无公钥的 sm3 ,然后做 Detach 验签
|
||||
*
|
||||
* @param orgData 待签名的原始数据
|
||||
* @param sign 签名数据
|
||||
* @return 验签是否通过
|
||||
*/
|
||||
boolean sm3WithoutPKDetachedVerify(byte[] orgData, String sign);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -174,6 +174,7 @@ public class SydApi4j implements SydApi {
|
||||
data.put("privateKey", privateKey);
|
||||
data.put("publicKey", publicKey);
|
||||
data.put("infoData", orgData);
|
||||
data.put("hashData", orgData);
|
||||
data.put("privateKeyTag", "999999999999999999999999999");
|
||||
|
||||
// 渲染发送
|
||||
@@ -330,7 +331,7 @@ public class SydApi4j implements SydApi {
|
||||
//ProtocolRender render = pset.getProtocolReqRender("75");
|
||||
Proto75 proto = new Proto75();
|
||||
|
||||
byte[] sign = Util.decodeBase64(base64Sign);
|
||||
byte[] sign = SYMUtil.base64SignAsDerSign(base64Sign);
|
||||
|
||||
// 填充数据
|
||||
HashMap<String, Object> packet = new HashMap<String, Object>();
|
||||
@@ -597,6 +598,18 @@ public class SydApi4j implements SydApi {
|
||||
return detachedVerify(DATA_HASH, hash, sign);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String sm3WithoutPKDetachedSign(byte[] orgData, String sCertDN) {
|
||||
byte[] hash = SM3Hash(orgData);
|
||||
return detachedSign(DATA_HASH, hash, sCertDN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sm3WithoutPKDetachedVerify(byte[] orgData, String sign) {
|
||||
byte[] hash = SM3Hash(orgData);
|
||||
return detachedVerify(DATA_HASH, hash, sign);
|
||||
}
|
||||
|
||||
// 测试通过
|
||||
@Override
|
||||
public String detachedSign(int dataType, byte[] orgData, String sCertDN) {
|
||||
|
||||
Reference in New Issue
Block a user