예제 #1
0
        public static void NoSupportForMultiByteTags(string caseName, string hexInput)
        {
            byte[]            bytes  = hexInput.HexToByteArray();
            DerSequenceReader reader = DerSequenceReader.CreateForPayload(bytes);

            Assert.Throws <CryptographicException>(() => reader.PeekTag());
            Assert.Throws <CryptographicException>(() => reader.SkipValue());
            Assert.Throws <CryptographicException>(() => reader.ReadNextEncodedValue());
        }
예제 #2
0
        public static void InvalidLengthSpecified(string hexInput)
        {
            byte[]            bytes  = hexInput.HexToByteArray();
            DerSequenceReader reader = DerSequenceReader.CreateForPayload(bytes);

            // Doesn't throw.
            reader.PeekTag();

            // Since EatTag will have succeeded the reader needs to be reconstructed after each test.
            Assert.Throws <CryptographicException>(() => reader.SkipValue());
            reader = DerSequenceReader.CreateForPayload(bytes);

            Assert.Throws <CryptographicException>(() => reader.ReadOctetString());
            reader = DerSequenceReader.CreateForPayload(bytes);

            Assert.Throws <CryptographicException>(() => reader.ReadNextEncodedValue());
        }