コード例 #1
0
        public void TestDisposal()
        {
            string    test;
            CryptoKey key = new PasswordKey(TEST_PASSWORD);

            test = key.Encrypt("Test");
            key.Dispose();

            key.Decrypt(test);
            Assert.Fail();
        }
コード例 #2
0
        public void TestDecodeFromNewSalt()
        {
            byte[] bytes;
            byte[] svalue = Encoding.ASCII.GetBytes("some text value");

            using (PasswordKey pk = new PasswordKey(TEST_PASSWORD))
                bytes = pk.Encrypt(svalue);

            using (PasswordKey pk = new PasswordKey(TEST_PASSWORD))
                bytes = pk.Decrypt(bytes);

            Assert.AreEqual(svalue, bytes);
        }