Example #1
0
        public void TestWithOneCharString()
        {
            byte[] result = StringsFunctions.StringToUtf8Bytes("0");

            CollectionAssert.AreEqual(
                result,
                new byte[] { 48 }
                );
        }
Example #2
0
        public void TestWithRegularString2()
        {
            byte[] result = StringsFunctions.StringToUtf8Bytes("Hack The Planet!!!");

            CollectionAssert.AreEqual(
                result,
                new byte[] { 72, 97, 99, 107, 32, 84, 104, 101, 32, 80, 108, 97, 110, 101, 116, 33, 33, 33 }
                );
        }
Example #3
0
        public void TestWithNullString()
        {
            byte[] result = StringsFunctions.StringToUtf8Bytes(null);

            CollectionAssert.AreEqual(
                result,
                null
                );
        }
Example #4
0
        public void TestWithRegularString1()
        {
            byte[] result = StringsFunctions.StringToUtf8Bytes("Test1");

            CollectionAssert.AreEqual(
                result,
                new byte[] { 84, 101, 115, 116, 49 }
                );
        }
Example #5
0
        public void TestConstructor_NotValidKey4()
        {
            try
            {
                TripleDES result = SecurityFunctions.InitTripleDES(StringsFunctions.StringToUtf8Bytes(UnitTestData.CONST_INVALID_KEY4));

                Assert.Fail();
            }
            catch (CryptographicException)
            {
            }
            catch (Exception)
            {
                Assert.Fail();
            }
        }
Example #6
0
 public static byte[] TripleDESEncryptFramework(byte[] plainText, string key)
 {
     return(TripleDESEncryptFramework(plainText, StringsFunctions.StringToUtf8Bytes(key)));
 }
Example #7
0
 public static byte[] TripleDESEncryptFramework(string plainText, byte[] key)
 {
     return(TripleDESEncryptFramework(StringsFunctions.StringToUtf8Bytes(plainText), key));
 }
Example #8
0
 public static string TripleDESDecryptFramework(byte[] plainData, string key)
 {
     return(TripleDESDecryptFramework(plainData, StringsFunctions.StringToUtf8Bytes(key)));
 }
Example #9
0
 public static string TripleDESDecryptFramework(string data, byte[] key)
 {
     return(TripleDESDecryptFramework(StringsFunctions.StringToUtf8Bytes(data), key));
 }
Example #10
0
        public void TestConstructor_ValidKey2()
        {
            TripleDES result = SecurityFunctions.InitTripleDES(StringsFunctions.StringToUtf8Bytes(UnitTestData.CONST_VALID_KEY2));

            Assert.AreNotEqual(result, null);
        }