public override void Encrypt(byte[] key, byte[] iv, string encryptData = null) { string temppic = Path.GetTempPath() + "temp" + Path.GetExtension(filePath); Image imgInput = Image.FromFile(this.filePath); imgInput = (Image)SteganographyWrapper.HideTextInImage(encryptData, (Bitmap)imgInput); imgInput.Save(temppic); imgInput.Dispose(); System.IO.File.Delete(filePath); System.IO.File.Copy(temppic, filePath); }
public override void Decrypt(byte[] key, byte[] iv) { try { Image imgInput = Image.FromFile(this.filePath); System.Windows.Forms.MessageBox.Show(":הטקסט שהוצפן הוא" + System.Environment.NewLine + SteganographyWrapper.ExtractTextFromImage((Bitmap)imgInput), "פיענוח הצפנה"); imgInput.Dispose(); } catch (Exception e) { System.Windows.Forms.MessageBox.Show(e.Message + " הפענוח נכשל מהסיבה", "תקלה", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } }