title: AES-128-GCM Tag doest not match
body: <p>I'm trying to encrypt and decrypt with aes-128-gcm.
  But when I'm running a test I have an error : </p>
  
  <p><em>System.Security.Cryptography.CryptographicException : The computed authentication tag did not match the input authentication tag.</em></p>
  
  <p>I don't understand why this error appears because when I print the tag in the encrypt method and print it in the decrypt method, they are the same ? I have read that the Associated Data could change something but I didn't find something.</p>
  
  <p>Here is the test</p>
  
  <pre><code>[TestCase("ABC", "ABC")]
  public void TestEncrypDecrypt(string message, string expected)
  {
       string cle = "FnUoIZvBUzC1Q/rn5WMi7Q==";
       var aes = new AESEncryption(cle);
       var crypted = aes.Encrypt(message);
       Assert.That(aes.Decrypt(crypted), Is.EqualTo(expected));
  }
  </code></pre>
  
  <p>And here is my class : </p>
  
  <pre><code>public class AESEncryption : IEncryption
      {
          private byte[] KEY { get; set; }
          private byte[] TAG { get; set; }
  
          public AESEncryption(string key)
          {
              KEY = Convert.FromBase64String(key);
              TAG = new byte[16];
          }
  
          public string Encrypt(string message)
          {
              byte[] plainText = Encoding.UTF8.GetBytes(message);
              byte[] ciphertext = new byte[plainText.Length];
              using (AesGcm aesGcm = new AesGcm(KEY))
              {
                  aesGcm.Encrypt(
                      new byte[]{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B }, 
                      plainText, 
                      ciphertext, 
                      TAG);
              }
              return Convert.ToBase64String(ciphertext);
          }
  
          public string Decrypt(string message)
          {
              byte[] cipherText = Encoding.UTF8.GetBytes(message);
              byte[] plainText = new byte[cipherText.Length];
              using (AesGcm aesGcm = new AesGcm(KEY))
              {
                  aesGcm.Decrypt(new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B }, 
                      cipherText, 
                      TAG, 
                      plainText);
                  Console.WriteLine("d1 " + Convert.ToBase64String(TAG));
              }
  
              return Convert.ToBase64String(plainText);
          }
  
      }
  
  </code></pre>
  
  <p>Thanks a lot !</p>