コード例 #1
0
        public void EncryptStrTest()
        {
            OneTimePad myCipher = new OneTimePad(TEST_STR.Length);

            TestCtor(myCipher);
            myCipher.GenKey();
            TestStrEnc(myCipher, myCipher.Encrypt(TEST_STR), TEST_STR.Length);
        }
コード例 #2
0
        public void GenKeyTest()
        {
            OneTimePad cipher = new OneTimePad(TEST_STR.Length);

            TestCtor(cipher);
            cipher.GenKey();
            Assert.IsNotNull(cipher.GetKey(), "key was not intialized");
            Assert.AreEqual(TEST_STR.Length, cipher.GetKey().Length, "Incorrect KeyLen Found");
        }
コード例 #3
0
        public void DecryptStrTest()
        {
            OneTimePad myCipher = new OneTimePad(TEST_STR.Length);

            TestCtor(myCipher);
            myCipher.GenKey();
            string encStr = myCipher.Encrypt(TEST_STR);

            TestStrEnc(myCipher, myCipher.Encrypt(TEST_STR), TEST_STR.Length);
            TestStrDec(encStr, myCipher.Decrypt(encStr));
        }
コード例 #4
0
        public void SetKeyTest()
        {
            const int  KEY_LEN      = 10;
            OneTimePad encryptorOne = new OneTimePad();
            OneTimePad encryptorTwo = new OneTimePad(KEY_LEN);

            TestCtor(encryptorOne);
            TestCtor(encryptorTwo);
            encryptorTwo.GenKey();
            encryptorOne.SetKey(encryptorTwo.GetKey());
            CompareKeys(encryptorTwo.GetKey(), encryptorOne.GetKey());
        }