public IHttpActionResult SetProfile(string id, [FromBody] SignedEnvelope signedEnvelope) { try { if (VerySignatureOfSignedEnvelope(id, signedEnvelope) == false) { return(BadRequest()); } _storageService.SetProfile(id, signedEnvelope.Data); return(Ok()); } catch (FileNotFoundException) { return(NotFound()); } }
public bool VerySignatureOfSignedEnvelope(string id, SignedEnvelope signedEnvelope) { bool ret = false; string profile = _storageService.GetProfile(id); if (String.IsNullOrEmpty(profile) == false) { //TODO: Look into profile and search for public key string key = signedEnvelope.AgentId; ///HACK: should look into profile and grab public key of UserAget Service if (CryptographyHelper.VerifySignedData(signedEnvelope.Data, signedEnvelope.Signature, key) == true) { ret = true; } } return(ret); }