Exemplo n.º 1
0
        public void should_not_decrypt_eol()
        {
            int expectedByte = -1;
            var encryption = CreateDefaultEncryption();

            Stream memoryStream = new MemoryStream();
            encryption.ResetState();

            var byteStream = new EncryptedByteStream(memoryStream, encryption);
            var actualByte = byteStream.ReadByte();

            Assert.That(actualByte, Is.EqualTo(expectedByte));
        }
Exemplo n.º 2
0
        public void should_read_decrypted_byte()
        {
            byte expectedByte = 0x01;
            byte givenByte = 0x01;
            var encryption = CreateDefaultEncryption();

            Stream memoryStream = new MemoryStream(new byte[] { encryption.EncryptByte(givenByte) });
            encryption.ResetState();

            var byteStream = new EncryptedByteStream(memoryStream, encryption);
            var actualByte = (byte)byteStream.ReadByte();

            Assert.That(actualByte, Is.EqualTo(expectedByte));
        }