title: AES to encrypt a single block shows error
body: <p>when run below program it shows error.</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text.RegularExpressions;
  using System.Security.Cryptography;
  using System.Web.UI.WebControls;
  using System.Configuration;
  using System.Text;
  
  namespace Rextester
  {
      public class Program
      {
          public static void Main(string[] args)
          {
              //Your code goes here
              Console.WriteLine("Hello, world!");
  
              byte[] plainText = UTF8Encoding.UTF8.GetBytes("textt");
              byte[] key = UTF8Encoding.UTF8.GetBytes("1234567890123456");
              AES_encrypt_block(plainText,key);
          }
          private static byte[] AES_encrypt_block(byte[] plainText, byte[] Key)
          {
          byte[] output_buffer = new byte[plainText.Length];
  
          using (AesManaged aesAlg = new AesManaged())
          {
          //If CBC, must initialize IV = O_{128}
          //aesAlg.Mode = CipherMode.CBC;
          //aesAlg.IV = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
          aesAlg.Mode = CipherMode.ECB;
  
          aesAlg.BlockSize = 128;
          aesAlg.KeySize = 128;
          aesAlg.Padding = PaddingMode.None;
          aesAlg.Key = Key;
  
          // Create a decrytor to perform the stream transform.
          ICryptoTransform encryptor = aesAlg.CreateEncryptor(aesAlg.Key, aesAlg.IV);
          encryptor.TransformBlock(plainText, 0, plainText.Length, output_buffer, 0);
          }
  
          return output_buffer;
      }
      }
  
  }
  </code></pre>
  
  <p><strong>ERROR</strong></p>
  
  <blockquote>
    <p>Exception in user code:</p>
    
    <p>System.ArgumentException: Value was invalid.
     at >System.Security.Cryptography.RijndaelManagedTransform.TransformBlock(Byte[] >inputBuffer, Int32 inputOffset, Int32 inputCount, Byte[] outputBuffer, Int32 >outputOffset)
      at Rextester.Program.AES_encrypt_block(Byte[] plainText, Byte[] Key)
      at Rextester.Program.Main(String[] args)"</p>
  </blockquote>