public void TestUniqueDerives()
        {
            PasswordKey pk1 = new PasswordKey(TEST_PASSWORD);
            PasswordKey pk2 = new PasswordKey(TEST_PASSWORD);

            pk2.Salt = pk1.Salt;
            Assert.AreEqual(pk1.CreateKey().Key, pk2.CreateKey().Key);
            pk2.IterationCount /= 2;
            Assert.AreEqual(pk1.Salt, pk2.Salt);
            Assert.AreNotEqual(pk1.CreateKey().Key, pk2.CreateKey().Key);
        }
        public void TestSetIv()
        {
            using (PasswordKey key = new PasswordKey("bla"))
            {
                Assert.AreEqual(AESCryptoKey.ProcessDefaultIV, key.IV);
                byte[] newIv = Guid.NewGuid().ToByteArray();
                key.IV = newIv;

                Assert.AreEqual(newIv, key.IV);
                Assert.AreEqual(newIv, key.CreateKey().IV);
            }
        }
        public void TestRecreate()
        {
            PasswordKey pk1 = new PasswordKey(TEST_PASSWORD);
            PasswordKey pk2 = new PasswordKey(SecureStringUtils.Create(TEST_PASSWORD));

            Assert.AreNotEqual(pk1.CreateKey().Key, pk2.CreateKey().Key);

            pk2.Salt = pk1.Salt;
            Assert.AreEqual(pk1.CreateKey().Key, pk2.CreateKey().Key);
            pk1.CreateKey();
            Assert.AreEqual(pk1.CreateKey().Key, pk2.CreateKey().Key);

            pk1.Salt = new Salt();
            Assert.AreNotEqual(pk1.Salt, pk2.Salt);
            Assert.AreNotEqual(pk1.CreateKey().Key, pk2.CreateKey().Key);
            Assert.AreEqual(pk1.CreateKey().Key, pk2.CreateKey(pk1.Salt).Key);
            pk2.Salt = pk1.Salt;
            Assert.AreEqual(pk1.Salt, pk2.Salt);
            Assert.AreEqual(pk1.CreateKey().Key, pk2.CreateKey().Key);
        }