public virtual void testEncryptDecrypt256_HugeData() { System.Console.Out.WriteLine("encrypt and decrypt huge Data"); byte[] plainInput = new byte[1000000]; KeyGenSHA3 keyGen = new KeyGenSHA3(); string hexKey = keyGen.generateKey(256, "password"); byte[] bKey = CryptobyHelper.hexStringToBytes(hexKey); CryptAES instance = new CryptAES(); byte[] expResult = plainInput; byte[] result = instance.encrypt(plainInput, bKey); result = instance.decrypt(result, bKey); for (int i = 0; i < 10; i++) { result = instance.encrypt(plainInput, bKey); result = instance.decrypt(result, bKey); } Assert.AreEqual(expResult, result); }
public virtual void testEncryptDecrypt256() { System.Console.Out.WriteLine("encrypt and decrypt testphrase"); byte[] plainInput = Encoding.UTF8.GetBytes("Text to Test for Testing from Tester by Testcase" ); KeyGenSHA3 keyGen = new KeyGenSHA3(); string hexKey = keyGen.generateKey(256, "password"); byte[] bKey = CryptobyHelper.hexStringToBytes(hexKey); CryptAES instance = new CryptAES(); byte[] expResult = plainInput; byte[] result = instance.encrypt(plainInput, bKey); result = instance.decrypt(result, bKey); Assert.AreEqual(expResult, result); }
public virtual void testEncryptDecrypt256() { System.Console.Out.WriteLine("encrypt and decrypt testphrase"); byte[] plainInput = Encoding.UTF8.GetBytes("Text to Test for Testing from Tester by Testcase" ); KeyGenSHA3 keyGen = new KeyGenSHA3(); string hexKey = keyGen.generateKey(256, "password"); byte[] bKey = CryptobyHelper.hexStringToBytes(hexKey); CryptAES instance = new CryptAES(); byte[] expResult = plainInput; byte[] result = instance.encrypt(plainInput, bKey); result = instance.decrypt(result, bKey); Assert.AreEqual(expResult, result); }
public virtual void testEncryptDecrypt256_false() { System.Console.Out.WriteLine("crypt almost false key"); byte[] plainInput = Encoding.UTF8.GetBytes("Text to Test for Testing from Tester by Testcase" ); string hexKey = "13A9489AF957FF7B5E8E712737D0B4A0C92AE8EBAE9DD11E9C11B8CB79707017"; byte[] bKey = CryptobyHelper.hexStringToBytes(hexKey); CryptAES instance = new CryptAES(); byte[] expResult = plainInput; byte[] result = instance.encrypt(plainInput, bKey); hexKey = "13A9489AF957FF7B5E8E712737D0B4A0C92AE8EBAE9DD11E9C11B8CB79707011"; bKey = CryptobyHelper.hexStringToBytes(hexKey); result = instance.decrypt(result, bKey); Assert.IsFalse(Encoding.UTF8.GetString(expResult).Equals (Encoding.UTF8.GetString(result))); }
public virtual void testEncryptDecrypt256_false() { System.Console.Out.WriteLine("crypt almost false key"); byte[] plainInput = Encoding.UTF8.GetBytes("Text to Test for Testing from Tester by Testcase" ); string hexKey = "13A9489AF957FF7B5E8E712737D0B4A0C92AE8EBAE9DD11E9C11B8CB79707017"; byte[] bKey = CryptobyHelper.hexStringToBytes(hexKey); CryptAES instance = new CryptAES(); byte[] expResult = plainInput; byte[] result = instance.encrypt(plainInput, bKey); hexKey = "13A9489AF957FF7B5E8E712737D0B4A0C92AE8EBAE9DD11E9C11B8CB79707011"; bKey = CryptobyHelper.hexStringToBytes(hexKey); result = instance.decrypt(result, bKey); Assert.IsFalse(Encoding.UTF8.GetString(expResult).Equals (Encoding.UTF8.GetString(result))); }
public virtual void testEncryptDecrypt256_CBC() { System.Console.Out.WriteLine("encrypt and decrypt recurring words"); byte[] plainInput = Encoding.UTF8.GetBytes("TestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTest" ); KeyGenSHA3 keyGen = new KeyGenSHA3(); string hexKey = keyGen.generateKey(256, "password"); byte[] bKey = CryptobyHelper.hexStringToBytes(hexKey); CryptAES instance = new CryptAES(); byte[] expResult = plainInput; byte[] result = instance.encrypt(plainInput, bKey); string resString = CryptobyHelper.bytesToHexStringUpper(result); for (int i = 0; i < resString.Length - 32; i += 32) { Assert.IsFalse(resString.Substring(i, 32).Equals (resString.Substring(i + 32, 32))); } result = instance.decrypt(result, bKey); Assert.AreEqual(expResult, result); }
public virtual void testEncryptDecrypt256_CBC() { System.Console.Out.WriteLine("encrypt and decrypt recurring words"); byte[] plainInput = Encoding.UTF8.GetBytes("TestTestTestTestTestTestTestTestTestTestTestTestTestTestTestTest" ); KeyGenSHA3 keyGen = new KeyGenSHA3(); string hexKey = keyGen.generateKey(256, "password"); byte[] bKey = CryptobyHelper.hexStringToBytes(hexKey); CryptAES instance = new CryptAES(); byte[] expResult = plainInput; byte[] result = instance.encrypt(plainInput, bKey); string resString = CryptobyHelper.bytesToHexStringUpper(result); for (int i = 0; i < resString.Length - 32; i += 32) { Assert.IsFalse(resString.Substring(i, 32).Equals (resString.Substring(i + 32, 32))); } result = instance.decrypt(result, bKey); Assert.AreEqual(expResult, result); }
public virtual void testEncryptDecrypt256_HugeData() { System.Console.Out.WriteLine("encrypt and decrypt huge Data"); byte[] plainInput = new byte[1000000]; KeyGenSHA3 keyGen = new KeyGenSHA3(); string hexKey = keyGen.generateKey(256, "password"); byte[] bKey = CryptobyHelper.hexStringToBytes(hexKey); CryptAES instance = new CryptAES(); byte[] expResult = plainInput; byte[] result = instance.encrypt(plainInput, bKey); result = instance.decrypt(result, bKey); for (int i = 0; i < 10;i++){ result = instance.encrypt(plainInput, bKey); result = instance.decrypt(result, bKey); } Assert.AreEqual(expResult, result); }
public void testAESDec() { resData = aes.decrypt(modData, privKey); }