public IActionResult Decrypt(EncryptModel model) { var enc = new Encryptor(model.KeyPassword); model.PlainText = enc.Decrypt(model.CipherText); return(View("Index", model)); }
public IActionResult Hash(EncryptModel model) { var enc = new Encryptor(model.KeyPassword); model.HashCode = enc.Hash(model.PlainText, Encoding.Default.GetBytes("MrSalty")); return(View("Index", model)); }
//Запись информации через интерфейс пользователя public PageResult OnPostUploadTextAsync(string text) { model = new EncryptModel(text, ToEncrypt, Key); Key = ""; return(Page()); }
public IActionResult Index() { var model = new EncryptModel() { CipherText = "", PlainText = "", HashCode = "" }; return(View(model)); }
//Запись информации с помощью файла public async Task <IActionResult> OnPostUploadAsync() { if (FormFile != null && FormFile?.Length > 0 && (FormFile.ContentType == "application/vnd.openxmlformats-officedocument.wordprocessingml.document" || FormFile.ContentType == "text/plain")) { try { //.docx if (FormFile.ContentType == "application/vnd.openxmlformats-officedocument.wordprocessingml.document") { using (var memoryStream = new MemoryStream()) { await FormFile.CopyToAsync(memoryStream); using (WordprocessingDocument doc = WordprocessingDocument.Open(memoryStream, true)) { var body = doc.MainDocumentPart.Document.Body; original = body.InnerText; } } model = new EncryptModel(original, ToEncrypt, Key); Key = ""; } else // .txt { using (var memoryStream = new MemoryStream()) { await FormFile.CopyToAsync(memoryStream); if (memoryStream.Length < 2097152) { original = Encoding.UTF8.GetString(memoryStream.ToArray()); } else { ModelState.AddModelError("File", "The file is too large."); } } model = new EncryptModel(original, ToEncrypt, Key); Key = ""; } } catch (Exception e) { ModelState.AddModelError("File", "ИСКЛЮЧЕНИЕ:" + e.Message.ToString()); return(Page()); } } else { ModelState.AddModelError("File", "Choose file bliiin!!"); } return(Page()); }
public ActionResult Create(TransactionModel model) { //Session["TransModel"] = model; var enmodel = new EncryptModel(); enmodel.accountNumber = model.AccountNo; enmodel.channelId = "10"; int mid = 0; int.TryParse(model.MerchantId, out mid); enmodel.merchantId = mid; //SecurityHelper sechelper = new SecurityHelper(); //var param = sechelper.EncryptRendererParam(enmodel); var rendurl = "http://172.29.30.43:3000/?param=";// + param; return(Json(rendurl, JsonRequestBehavior.AllowGet)); }
public IActionResult ServerPublicKey([FromBody] EncryptModel model) { EncryptionServices.EncryptWithRsa(model.Data, model.PrivateKey); return(Ok()); }