Exemplo n.º 1
0
        public void StringCrypt_Basic_RFC2898()
        {
            string input = "test 123 %$#";

            byte[] output      = StringCrypt.EncryptRfc2898(input);
            string outputFinal = StringCrypt.DecryptRfc2898(output);

            Assert.AreEqual(input, outputFinal, "String output should be as exected after decrypt.");
        }
Exemplo n.º 2
0
        public void StringCrypt_Specific_RFC2898_Salt()
        {
            string           input     = "foobar and some special characters $%^&*()";
            RFC2898CryptInfo cryptInfo = new RFC2898CryptInfo();

            cryptInfo.salt = "RandomSalt12634asdf";

            byte[] output      = StringCrypt.EncryptRfc2898(input, cryptInfo);
            string outputFinal = StringCrypt.DecryptRfc2898(output, cryptInfo);

            Assert.AreEqual(input, outputFinal, "String output should be as exected after decrypt.");
        }
Exemplo n.º 3
0
        public void StringCrypt_Specific_RFC2898_Password()
        {
            string           input     = "foobar and some special characters $%^&*()";
            RFC2898CryptInfo cryptInfo = new RFC2898CryptInfo();

            cryptInfo.password = "******";

            byte[] output      = StringCrypt.EncryptRfc2898(input, cryptInfo);
            string outputFinal = StringCrypt.DecryptRfc2898(output, cryptInfo);

            Assert.AreEqual(input, outputFinal, "String output should be as exected after decrypt.");
        }
Exemplo n.º 4
0
        public void StringCrypt_Specific_RFC2898_VIKey()
        {
            string           input     = "foobar and some special characters $%^&*()";
            RFC2898CryptInfo cryptInfo = new RFC2898CryptInfo();

            cryptInfo.VIKey = "abc12366FFTYYU^d";

            byte[] output      = StringCrypt.EncryptRfc2898(input, cryptInfo);
            string outputFinal = StringCrypt.DecryptRfc2898(output, cryptInfo);

            Assert.AreEqual(input, outputFinal, "String output should be as exected after decrypt.");
        }
Exemplo n.º 5
0
        public void StringCrypt_Specific_RFC2898_WrongVIKey()
        {
            string           input      = "foobar and some special characters $%^&*()";
            RFC2898CryptInfo cryptInfo1 = new RFC2898CryptInfo();

            cryptInfo1.VIKey = "983GET$%I8876824";
            RFC2898CryptInfo cryptInfo2 = new RFC2898CryptInfo();

            cryptInfo2.VIKey = "Sdfert@$#G53df$#";

            byte[] output      = StringCrypt.EncryptRfc2898(input, cryptInfo1);
            string outputFinal = StringCrypt.DecryptRfc2898(output, cryptInfo2);

            Assert.AreNotEqual(input, outputFinal, "String output should not be decryptable.");
        }
Exemplo n.º 6
0
        public void StringCrypt_Specific_RFC2898_WrongSalt()
        {
            string           input      = "foobar and some special characters $%^&*()";
            RFC2898CryptInfo cryptInfo1 = new RFC2898CryptInfo();

            cryptInfo1.salt = "salt1ABCD";
            RFC2898CryptInfo cryptInfo2 = new RFC2898CryptInfo();

            cryptInfo2.salt = "salt2ABCD";

            byte[] output      = StringCrypt.EncryptRfc2898(input, cryptInfo1);
            string outputFinal = StringCrypt.DecryptRfc2898(output, cryptInfo2);

            Assert.AreNotEqual(input, outputFinal, "String output should not be decryptable.");
        }
Exemplo n.º 7
0
        public void StringCrypt_Specific_RFC2898_WrongPassword()
        {
            string           input      = "foobar and some special characters $%^&*()";
            RFC2898CryptInfo cryptInfo1 = new RFC2898CryptInfo();

            cryptInfo1.password = "******";
            RFC2898CryptInfo cryptInfo2 = new RFC2898CryptInfo();

            cryptInfo2.password = "******";

            byte[] output      = StringCrypt.EncryptRfc2898(input, cryptInfo1);
            string outputFinal = StringCrypt.DecryptRfc2898(output, cryptInfo2);

            Assert.AreNotEqual(input, outputFinal, "String output should not be decryptable.");
        }