Exemplo n.º 1
0
        public static void TestClone()
        {
            V2PlaintextLengthsEncryptedHeaderBlock block = new V2PlaintextLengthsEncryptedHeaderBlock(new V2AesCrypto(new V2DerivedKey(new Passphrase("secret"), 256).DerivedKey, SymmetricIV.Zero128, 0));
            V2PlaintextLengthsEncryptedHeaderBlock clone = (V2PlaintextLengthsEncryptedHeaderBlock)block.Clone();

            Assert.That(!Object.ReferenceEquals(block.GetDataBlockBytes(), clone.GetDataBlockBytes()));
            Assert.That(block.GetDataBlockBytes(), Is.EquivalentTo(clone.GetDataBlockBytes()));
        }
Exemplo n.º 2
0
        public static void TestCompressedPlaintextLength()
        {
            V2PlaintextLengthsEncryptedHeaderBlock block = new V2PlaintextLengthsEncryptedHeaderBlock(new V2AesCrypto(new V2DerivedKey(new Passphrase("secret"), 256).DerivedKey, SymmetricIV.Zero128, 0));

            Assert.That(block.CompressedPlaintextLength, Is.EqualTo(0));

            block.PlaintextLength           = 123;
            block.CompressedPlaintextLength = 456;
            Assert.That(block.CompressedPlaintextLength, Is.EqualTo(456));
        }