コード例 #1
0
ファイル: Form1.cs プロジェクト: jpd21122012/Microsoft70-483
        private void btnEncrypt_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "Public Keys (*.xml)|*.xml";
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                Stream temp          = openFileDialog.OpenFile();
                String publicKeyXml  = new StreamReader(temp).ReadToEnd();
                byte[] encryptedData = EncryptionClass.EncryptText(tbMessage.Text, publicKeyXml);
                tbResult.Text = Convert.ToBase64String(encryptedData);
                tbMessage.Clear();
                tbMessage.Text = tbResult.Text;
                tbResult.Clear();
            }
        }