Class class class class value in String keySymmetric of class ACEcrypt. strong> But I do not know how to receive and cast: (
Form class to enter password.
public partial class Senha : Form
{
string key;
public Senha()
{
InitializeComponent();
}
private void btn_enviarKey_Click(object sender, EventArgs e)
{
key = textBoxKey.Text;
this.Close();
}
}
Main form class
public partial class ACEcrypt : Form
{
string chaveSimetrica;
public ACEcrypt()
{
InitializeComponent();
}
private void btn_criptografar_Click(object sender, EventArgs e)
{
if (openFileCrypt.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
exibirCaminho.Text = openFileCrypt.FileName;
//Input do Arquivo ou Pasta
string streamPath = exibirCaminho.Text;
FileStream inStream = File.OpenRead(openFileCrypt.FileName);
//FileStream outStream = File.OpenWrite(openFileCrypt.FileName + ".ace");
// int b;
//while ((b = inStream.ReadByte()) > -1)
// outStream.WriteByte((byte)b);
//outStream.Flush();
//outStream.Close();
inStream.Close();
Senha ISCrypt = new Senha();
ISCrypt.ShowDialog();
ISCrypt.FormClosing += new FormClosingEventHandler(ISCrypt_FormClosing);
//Para teste
//MessageBox.Show(chaveSimetrica);
}
}
void ISCrypt_FormClosing(object sender, FormClosingEventArgs e)
{
if ((sender as Senha).textData != null)
chaveSimetrica = (string)(sender as Senha).textData;
}
private void btn_descriptografar_Click(object sender, EventArgs e)
{
if (openFileDecrypt.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
exibirCaminho.Text = openFileDecrypt.FileName;
}
}
}