title: Decryption of date from file using AES returning random characters
body: <p>I am reading an encrypted date from a file using AES, and on decryption the string returned is the following : ���C l&amp;|�=O����3 AM</p>
  
  <p>I have read some things but still dont understand what is happening.</p>
  
  <p>Any help is greatly appreciated. Thank you.</p>
  
  <pre><code>  public static AesCryptoServiceProvider provider = new AesCryptoServiceProvider()
          {
              Mode = CipherMode.CBC,
              Padding = PaddingMode.PKCS7,
              Key = Encoding.ASCII.GetBytes(secretKey),
              IV = new byte[] { 4,  10, 221, 22, 71, 129, 95, 231, 229, 174, 247, 119, 241, 156, 249, 57 },
              BlockSize = 128,
          };
  
          public static string FIPSEncryptDecrypt(string cipherText, bool Encrypt)
          {
              try
              {
                  if (Encrypt)
                  {
                      byte[] toEncryptArray = UTF8Encoding.UTF8.GetBytes(cipherText);
                      ICryptoTransform cTransform = provider.CreateEncryptor(provider.Key, provider.IV);
                      byte[] resultArray = cTransform.TransformFinalBlock(toEncryptArray, 0, toEncryptArray.Length);
                      return Convert.ToBase64String(resultArray, 0, resultArray.Length);
                  }
                  else
                  {
                      byte[] toDecryptArray = Convert.FromBase64String(cipherText);
                      ICryptoTransform cTransform = provider.CreateDecryptor(provider.Key, provider.IV);
                      byte[] resultArray = cTransform.TransformFinalBlock(toDecryptArray, 0, toDecryptArray.Length);
                      return UTF8Encoding.UTF8.GetString(resultArray, 0, resultArray.Length);
                  }
  
              }
              catch (Exception ex)
              {
                  return string.Empty;
              }
          }
  </code></pre>