public PayLoadDTO GetPayLoadDTO(GMService gMService, string priKey) { var rawKey = gMService.SM2Decrypt("04" + this.Key, priKey, false); var rawPayLod = gMService.SM4_Decrypt_CBC(this.PayLoad, rawKey, this.IV, false); var rawPayLodObj = PayLoadDTO.FromJSON(rawPayLod); return rawPayLodObj; }
public string GetPayLoadValue(GMService gMService,string priKey) { var rawKey = gMService.SM2Decrypt("04"+this.Key, priKey,false); var rawPayLod=gMService.SM4_Decrypt_CBC(this.PayLoad, rawKey, this.IV,false); var rawPayLodObj= PayLoadDTO.FromJSON(rawPayLod); var dataHex= Common.Utils.HexUtil.ByteArrayToString(Encoding.UTF8.GetBytes(rawPayLodObj.Data)); var myHash = gMService.SM3(dataHex); if (!myHash.ToUpper().Equals(rawPayLodObj.Hash.ToUpper())) { return null; } return rawPayLodObj.Data; }
public string getSM4Key(GMService gMService, string priKey) { var rawKey = gMService.SM2Decrypt("04" + this.Key, priKey, false); return rawKey; }