public async Task<HelloSignCallback> ParseAsync(HttpRequestMessage request) { var p = new InMemoryMultipartFormDataStreamProvider(); await request.Content.ReadAsMultipartAsync(p); var cb = HelloSignCallback.Parse(p.FormData["json"]); // only validate the hash if the ApiKey has been set if (string.IsNullOrEmpty(ApiKey)) { var hash = HelloSignUtilities.GenerateEventHash(ApiKey, cb.Event.EventTime, cb.Event.EventType); if (string.IsNullOrEmpty(hash)) { throw new Exception(string.Format("Was not able to compute event hash:\r\n{0}", p.FormData["json"])); } if (hash != cb.Event.EventHash) { throw new Exception(string.Format("Event hash does not match expected value; This event may not be genuine. Make sure this API key matches the one on the account generating callbacks:\r\n{0}", p.FormData["json"])); } } return cb; }