Esempio n. 1
0
        private void ButtonDecrypt_Click(object sender, EventArgs e)
        {
            var lib = new ImageWithSecret <string>
            {
                ImageModifying = imageHidden,
                DataReader     = new StringData(),
                WriteReadData  = new EmptyWriteReadPixelData()
            };

            foreach (var encryptionClass in GetAllEntities(false))
            {
                if (encryptionClass.Name == "SHI")
                {
                    lib.Encrypts.Add(new SHI(textKey.Text, SHI.Operator.RIGHT));
                }
                else
                {
                    lib.Encrypts.Add((IEncrypt)Activator.CreateInstance(encryptionClass, new Object[] { textKey.Text }));
                }
            }
            foreach (var compressionClass in GetAllEntities(true))
            {
                lib.Compressions.Add((ICompression)Activator.CreateInstance(compressionClass, null));
            }
            var decryptedData = lib.Decrypt(null);

            textToHide.Text   = decryptedData == "" ? "Incorrect key!" : decryptedData;
            imageOriginalHide = (Bitmap)ImageWithSecret <string> .ByteArrayToImage(AES.Base64Decode(decryptedData));

            hideModeSwitcher.Text        = "Text";
            textToHide.Visible           = true;
            pictureHide.Visible          = false;
            buttonOpenDialogHide.Visible = false;
            labelDropHide.Visible        = false;
        }