protected void BuildResult(NameValueCollection formVariables, string MD5secretKey, string callbackPW) { this.cartId = formVariables["cartId"]; this.desc = formVariables["desc"]; this.transId = formVariables["transId"]; this.charenc = formVariables["charenc"]; this.callbackPW = formVariables["callbackPW"]; this.instId = formVariables["instId"]; this.testMode = formVariables["testMode"]; this.authMode = formVariables["authMode"]; this.amount = formVariables["amount"]; this.amountString = formVariables["amountString"]; this.cost = formVariables["cost"]; this.currency = formVariables["currency"]; this.authAmount = formVariables["authAmount"]; this.authAmountString = formVariables["authAmountString"]; this.authCost = formVariables["authCost"]; this.authCurrency = formVariables["authCurrency"]; this.transStatus = formVariables["transStatus"]; this.transTime = formVariables["transTime"]; this.rawAuthCode = formVariables["rawAuthCode"]; this.countryMatch = formVariables["countryMatch"]; this.rawAuthMessage = formVariables["rawAuthMessage"]; this.msgType = formVariables["msgType"]; this.AVS = formVariables["AVS"]; this.cardType = formVariables["cardType"]; this.ipAddress = formVariables["ipAddress"]; this.name = formVariables["name"]; this.address1 = formVariables["address1"]; this.address2 = formVariables["address2"]; this.address3 = formVariables["address3"]; this.region = formVariables["region"]; this.postcode = formVariables["postcode"]; this.country = formVariables["country"]; this.countryString = formVariables["countryString"]; this.tel = formVariables["tel"]; this.fax = formVariables["fax"]; this.email = formVariables["email"]; this.delvName = formVariables["delvName"]; this.delvAddress1 = formVariables["delvAddress1"]; this.delvAddress2 = formVariables["delvAddress2"]; this.delvAddress3 = formVariables["delvAddress3"]; this.delvTown = formVariables["delvTown"]; this.delvRegion = formVariables["delvRegion"]; this.delvPostcode = formVariables["delvPostcode"]; this.delvCountry = formVariables["delvCountry"]; this.delvCountryString = formVariables["delvCountryString"]; this.MC_callbacksignature = formVariables["MC_callbacksignature"]; var hashInputs = new StringBuilder(); hashInputs.Append(MD5secretKey); hashInputs.Append(":"); hashInputs.Append(this.currency); hashInputs.Append(":"); hashInputs.Append(this.cartId); hashInputs.Append(":"); hashInputs.Append(this.amount); byte[] hashDigest = new MD5CryptoServiceProvider().ComputeHash(ProviderUtils.StringToByteArray(hashInputs.ToString())); string newhash = ProviderUtils.ByteArrayToHexString(hashDigest); //Check if Callback Password matches if (newhash != this.MC_callbacksignature || this.callbackPW != callbackPW) { throw new Exception("Callback hash validation failed."); } }