private void btnLoad_Click(object sender, System.EventArgs e) { CipherData cd = store.Load(); txtInput.Text = Convert.ToBase64String(cd.CipherText); txtPassPhrase.Text = cd.Passphrase; txtSalt.Text = ByteArrayToHexString(cd.Salt); txtInitVector.Text = ByteArrayToHexString(cd.InitializationVector); txtResult.Text = ""; //aesCipher.IV = cd.InitializationVector; //System.Console.WriteLine("IV: {0}", FormatByteArray(aes.Iv)); AppendStatus(System.String.Format("{0} bytes loaded from {1} ({2} crypto bytes).\r\n", cd.GetLength(), store.FileName, cd.CipherText.Length) ); }
private void btnSave_Click(object sender, System.EventArgs e) { if ((LastEncrypted != null) && (LastEncrypted.Length != 0)) { CipherData cd = new CipherData(); cd.Salt = this.Salt; cd.Passphrase = txtPassPhrase.Text; cd.InitializationVector = HexStringToByteArray(txtInitVector.Text); cd.CipherText = LastEncrypted; store.Save(cd); AppendStatus(System.String.Format("{0} bytes saved in {1} ({2} crypto bytes).\r\n", cd.GetLength(), store.FileName, cd.CipherText.Length) ); } }