public IActionResult TestDecrypt([FromBody] dynamic value) { try { //var keyByteArray = Convert.FromBase64String(key); //var vectorByteArray = Convert.FromBase64String(vector); //var valueByteArray = Convert.FromBase64String(encryptedString); string svalue = Convert.ToString(value); dynamic UserJsonEntity = JsonConvert.DeserializeObject(svalue); //Extract Json string key = UserJsonEntity["key"].Value; string vector = UserJsonEntity["vector"].Value; string encryptedString = UserJsonEntity["encryptedString"].Value; // this should be a base64 encoded string result = _eKeyService.Decrypt(encryptedString, key, vector); return(Json(new { c = "", d = result })); } catch (Exception ex) { return(Json(new { c = ResultCode.GenericException, d = ex.Message })); } }
private string GetDecryptedString(string base64EncryptedValue, Subscription subscription) { var result = ""; try { var ekey = _eKeyService.GetActive(subscription.EnterpriseClientId); var decryptedString = _eKeyService.Decrypt(base64EncryptedValue, ekey.Key, ekey.IV); result = decryptedString; } catch { } return(result); }