Guest User

Untitled

a guest
May 20th, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. [HttpGet]
  2. public ActionResult Encrypted()
  3. {
  4. return View();
  5. }
  6.  
  7. [HttpPost]
  8. public ActionResult Encrypted(HttpPostedFileBase upload1, HttpPostedFileBase upload2, string key)
  9. {
  10. string fileName1 = Path.GetFileName(upload1.FileName);
  11. string fileName2 = Path.GetFileName(upload2.FileName);
  12.  
  13. upload1.SaveAs(Server.MapPath("~/Files/" + fileName1));
  14.  
  15.  
  16. Image image = Image.FromStream(upload2.InputStream);
  17. image.Save(Server.MapPath("~/Files/" + fileName2));
  18. string imagePath = Server.MapPath("~/Files/" + fileName2);
  19. Bitmap bmp = new Bitmap(imagePath);
  20.  
  21. StreamReader sr = new StreamReader(Server.MapPath("~/Files/" + fileName1));
  22. string text = sr.ReadLine();
  23. text = Crypto.EncryptStringAES(text, key);
  24.  
  25. var bmp1 = SteganoHelper.embedText(text, bmp);
  26. byte[] arr = bmp1.ToByteArray(ImageFormat.Bmp);
  27.  
  28. return File(arr, "image/bmp");
  29.  
  30. }
Add Comment
Please, Sign In to add comment