fix: signUpAllTypeCertificate的hash需要加上NetID

This commit is contained in:
brightestboy 2022-06-14 16:11:57 +08:00
parent 503995527b
commit 1e7a4d0767

View File

@ -67,7 +67,7 @@ object CertOperation extends DidOperation {
} else if (customCert.certType.isCertAuthentication || customCert.certType.isCertUndefined) {
// 身份校验证书通过signer注册指定或通过 signUpAllTypeCertificate
throw ContractException(toJsonErrMsg(canNotSignUpAuthCertificate))
} else if (!ctx.api.getSha256Tool.hashstr(ctx.api.getChainNetId+IdTool.DIDPrefixSeparator+IdTool.deleteLine(customCert.certificate)).equals(customCert.certHash)) {
} else if (!ctx.api.getSha256Tool.hashstr(ctx.api.getChainNetId + IdTool.DIDPrefixSeparator + IdTool.deleteLine(customCert.certificate)).equals(customCert.certHash)) {
throw ContractException(toJsonErrMsg(hashNotMatch))
} else {
ctx.api.setVal(certKey, customCert)
@ -133,7 +133,7 @@ object CertOperation extends DidOperation {
val certHashKey = hashPrefix + customCert.certHash
if (ctx.api.getVal(certKey) != null || ctx.api.getVal(certHashKey) != null) {
throw ContractException(toJsonErrMsg(certExists))
} else if (!ctx.api.getSha256Tool.hashstr(IdTool.deleteLine(customCert.certificate)).equals(customCert.certHash)) {
} else if (!ctx.api.getSha256Tool.hashstr(ctx.api.getChainNetId + IdTool.DIDPrefixSeparator + IdTool.deleteLine(customCert.certificate)).equals(customCert.certHash)) {
throw ContractException(toJsonErrMsg(hashNotMatch))
} else {
ctx.api.setVal(certKey, customCert)