Пример #1
0
 public ActionResult <DecryptMessageModel> Encrypt([FromBody] EncryptMessageModel input)
 {
     return(Ok(new DecryptMessageModel
     {
         data = _encryptionService.Encrypt(input.secret)
     }));
 }
Пример #2
0
        public async Task <DecryptMessageModel> EncryptAsync(EncryptMessageModel message)
        {
            var httpResponse = await httpClient.PostAsync($"{configuration["encryptionUrl"]}/api/encrypt",
                                                          new StringContent(JsonConvert.SerializeObject(message)));

            var response = await httpResponse.Content.ReadAsStringAsync();

            return(JsonConvert.DeserializeObject <DecryptMessageModel>(response));
        }
Пример #3
0
        public IHttpActionResult EncryptMessage(EncryptMessageModel model)
        {
            var cypherText = _cryptoService.Encrypt(model.Message, model.Key);
            var obj        = new
            {
                Success = true,
                Message = "",
                Result  = cypherText
            };

            return(Ok(obj));
        }
Пример #4
0
 public ActionResult <DecryptMessageModel> Encrypt([FromBody] EncryptMessageModel input)
 {
     return(Ok(_encryptionService.EncryptAsync(input)));
 }