Example #1
0
        private void btnAesGo_Click(object sender, EventArgs e)
        {
            var key  = StringUtil.ParseByteArray(txtKey.Text);
            var iv   = StringUtil.ParseByteArray(txtIV.Text);
            var data = StringUtil.ParseByteArray(txtEncData.Text);

            if (key != null && iv != null && data != null && key.Length == 16 && iv.Length == 16)
            {
                var aes = new Aes128Ctr(key, iv);
                aes.TransformBlock(data);
                txtDecData.Text = byteArrayToString(data);
            }
            else
            {
                MessageBox.Show("Error with length (must be a multiple of 2 or key & iv must be 16 bytes)");
            }
        }
Example #2
0
        private void btnAesGo_Click(object sender, EventArgs e)
        {
            var key = StringUtil.ParseByteArray(txtKey.Text);
            var iv = StringUtil.ParseByteArray(txtIV.Text);
            var data = StringUtil.ParseByteArray(txtEncData.Text);

            if (key != null && iv != null && data != null && key.Length == 16 && iv.Length == 16)
            {
                var aes = new Aes128Ctr(key, iv);
                aes.TransformBlock(data);
                txtDecData.Text = byteArrayToString(data);
            }
            else
                MessageBox.Show("Error with length (must be a multiple of 2 or key & iv must be 16 bytes)");
        }