public void EncryptNoKeyTest() { MonoAlphaSubCipher myCipher = new MonoAlphaSubCipher(); TestCtor(myCipher); myCipher.Encrypt(TEST_STR); }
public void DecryptNoKeyTest() { MonoAlphaSubCipher myCipher = new MonoAlphaSubCipher(); TestCtor(myCipher); myCipher.Decrypt(Convert.ToBase64String(Encoding.ASCII.GetBytes(TEST_STR))); }
public void EncryptFileTest() { MonoAlphaSubCipher masc = new MonoAlphaSubCipher(); masc.GenKey(); masc.Encrypt(BASE_FILE, ENC_FILE); TestFileEnc(); }
public void EncryptStrTest() { MonoAlphaSubCipher myCipher = new MonoAlphaSubCipher(); TestCtor(myCipher); myCipher.GenKey(); TestStrEnc(myCipher, myCipher.Encrypt(TEST_STR)); }
public void GenKeyTest() { MonoAlphaSubCipher masc = new MonoAlphaSubCipher(); TestCtor(masc); masc.GenKey(); Assert.AreNotEqual(0, masc.GetKey(), "key was not intialized"); }
public void DecryptStrTest() { MonoAlphaSubCipher myCipher = new MonoAlphaSubCipher(); TestCtor(myCipher); myCipher.GenKey(); string encStr = myCipher.Encrypt(TEST_STR); TestStrEnc(myCipher, encStr); TestStrDec(encStr, myCipher.Decrypt(encStr)); }
public void SetKeyTest() { MonoAlphaSubCipher encryptorOne = new MonoAlphaSubCipher(); MonoAlphaSubCipher encryptorTwo = new MonoAlphaSubCipher(); TestCtor(encryptorOne); TestCtor(encryptorTwo); encryptorTwo.GenKey(); encryptorOne.SetKey(encryptorTwo.GetKey()); CompareKeys(encryptorTwo.GetKey(), encryptorOne.GetKey()); }
public void DecryptFileTest() { MonoAlphaSubCipher masc = new MonoAlphaSubCipher(); System.IO.File.Exists(ENC_FILE); System.IO.File.Exists(DEC_FILE); masc.GenKey(); masc.Encrypt(BASE_FILE, ENC_FILE); TestFileEnc(); masc.Decrypt(ENC_FILE, DEC_FILE); TestFileDec(); }
static void TestStrEnc(MonoAlphaSubCipher cipher, string encStr) { Assert.IsNotNull(cipher.GetKey(), "Key was not Generated"); Assert.AreNotEqual(TEST_STR, encStr, "String did not encrypt"); }
static void TestCtor(MonoAlphaSubCipher cipher) { Assert.IsNull(cipher.GetKey(), "Incorrect intialized key Found"); }