Пример #1
0
        public async Task Encrypte()
        {
            if (txtPublicKey.Text == "")
            {
                await GenerateKey();
            }
            byte[] value = await CheckEncrypte(txtSource.Text);

            if (value != null)
            {
                byte[] result    = null;
                string key       = txtPublicKey.Text;
                bool   oaep      = cbbPadding.SelectedIndex == 1;
                int    keyLength = KeyLength;
                await Task.Run(() =>
                               result = RsaHelper.Encrypte(
                                   value,
                                   key,
                                   keyLength,
                                   oaep));

                txtResult.Text = await GetString(result, BinaryOutputMode);
            }
        }