私は AES 暗号化ラッパーと単体テストを 1 年以上使用しています。VS 2012 (または .net Framework 4 への更新) をインストールした後、単体テストに合格しません。不正なパスを渡したときに streamreader ブロックが CryptographicException をスローしていましたが、ArgumentNullException はスローしていません。
コードは にアップされています。 https://github.com/jnaus/Cryptography
これは、現在機能しない単体テストです。(BadSaltTest にも同じ問題があります)
[TestMethod]
[ExpectedException(typeof(CryptographicException),
  "Bad password was inappropriately allowed")]
public void BadPasswordTest()
{
    var cipherText = EncryptString();
    var decryptedText = AESCryptography.DecryptStringAES
        (cipherText,"A bad password", salt);
}
テスト結果: テスト メソッド CryptographyTest.AESTest.BadPasswordTest が例外 System.ArgumentNullException をスローしましたが、例外 System.Security.Cryptography.CryptographicException が予期されていました。例外メッセージ: System.ArgumentNullException: 値を null にすることはできません。パラメータ名:inputBuffer
コードを解読します。
public static string DecryptStringAES(string cipherText, 
    string password, byte[] salt)
{   
    RijndaelManaged aesAlg = null;
    string plaintext = null;
    try 
    {
        // generate the key from the shared secret and the salt
        Rfc2898DeriveBytes key = new Rfc2898DeriveBytes(password, salt);
        // Create a RijndaelManaged object
        // with the specified key and IV.
        aesAlg = new RijndaelManaged();
        aesAlg.Key = key.GetBytes(aesAlg.KeySize/8);
        aesAlg.IV = key.GetBytes(aesAlg.BlockSize/8);
        // Create a decrytor to perform the stream transform.
        ICryptoTransform decryptor = aesAlg.CreateDecryptor(aesAlg.Key, 
            aesAlg.IV);
        // Create the streams used for decryption.                
        byte[] bytes = Convert.FromBase64String(cipherText);
        using (MemoryStream msDecrypt = new MemoryStream(bytes)) 
        {
            using (CryptoStream csDecrypt = 
                new CryptoStream(msDecrypt, decryptor, CryptoStreamMode.Read)) 
            {
                //StreamReader now gives ArgumentNullException
                using (StreamReader srDecrypt = new StreamReader(csDecrypt)) 
                {
                    // Read the decrypted bytes from the decrypting stream
                    // and place them in a string.
                    plaintext = srDecrypt.ReadToEnd();
                }
            }
        }
    }
    finally 
    {
        // Clear the RijndaelManaged object.
        if (aesAlg != null)
        {
            aesAlg.Clear();
        }
    }
    return plaintext;
}