Esempio n. 1
0
        private void btnEncrypt_Click(object sender, EventArgs e)
        {
            var plainTextFilePath = txtPlainTextFile.Text;

            if (!File.Exists(plainTextFilePath))
            {
                return;
            }
            if (txtKey.Text.Trim().Length == 0)
            {
                return;
            }

            var          key               = txtKey.Text.Trim();
            const string targetDirectory   = @"C:\Users\Barry\Documents\My Dropbox\Deployment\LA3_Data";
            var          encryptedFilename = string.Format("LA3_Data_{0}.enc", DateTime.Now.ToString("yyyyMMddHHmmss"));
            var          encryptFile       = Symmetric.EncryptFile(plainTextFilePath, key, targetDirectory, encryptedFilename);

            txtKey.Text = "";
            MessageBox.Show(string.Format("File encrypted to [{0}]", encryptFile), @"Encrypted", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }