public static void TestNonTerminatingFileName()
        {
            FileNameInfoHeaderBlockForTest fileInfoHeaderBlock = new FileNameInfoHeaderBlockForTest();
            fileInfoHeaderBlock.HeaderCrypto = new AesCrypto(new AesKey());

            fileInfoHeaderBlock.FileName = "ABCDEFGHIJK.LMN";
            fileInfoHeaderBlock.SetBadNameWithoutEndingNul();

            Assert.Throws<InvalidOperationException>(() =>
            {
                string fileName = fileInfoHeaderBlock.FileName;

                // Avoid FxCop errors
                Object.Equals(fileName, null);
            });
        }
Esempio n. 2
0
        public static void TestNonTerminatingFileName()
        {
            FileNameInfoHeaderBlockForTest fileInfoHeaderBlock = new FileNameInfoHeaderBlockForTest();

            fileInfoHeaderBlock.HeaderCrypto = new AesCrypto(new AesKey());

            fileInfoHeaderBlock.FileName = "ABCDEFGHIJK.LMN";
            fileInfoHeaderBlock.SetBadNameWithoutEndingNul();

            Assert.Throws <InvalidOperationException>(() =>
            {
                string fileName = fileInfoHeaderBlock.FileName;

                // Avoid FxCop errors
                Object.Equals(fileName, null);
            });
        }
        public static void TestNonTerminatingFileName(CryptoImplementation cryptoImplementation)
        {
            SetupAssembly.AssemblySetupCrypto(cryptoImplementation);

            FileNameInfoHeaderBlockForTest fileInfoHeaderBlock = new FileNameInfoHeaderBlockForTest();

            fileInfoHeaderBlock.HeaderCrypto = new V1AesCrypto(new V1Aes128CryptoFactory(), new V1DerivedKey(new Passphrase("nonterminating")).DerivedKey, SymmetricIV.Zero128);

            fileInfoHeaderBlock.FileName = "ABCDEFGHIJK.LMN";
            fileInfoHeaderBlock.SetBadNameWithoutEndingNul();

            Assert.Throws <InvalidOperationException>(() =>
            {
                string fileName = fileInfoHeaderBlock.FileName;

                // Avoid FxCop errors
                Object.Equals(fileName, null);
            });
        }