Example #1
0
 private void btn_CreateKey_Click(object sender, EventArgs e)
 {
     if (isIvEncrypt())
     {
         var keyValue = RC2Crypto.CreateKey();
         textBox_Key.Text = keyValue.Key;
         textBox_IV.Text  = keyValue.Value;
     }
     else
     {
         textBox_Key.Text = RC2Crypto.CreateKeyNoIv();
     }
 }
Example #2
0
        public void TestDecrytorNoIv()
        {
            String key = RC2Crypto.CreateKeyNoIv();

            Assert.IsNotNull(key);
            Assert.IsTrue(key.Length > 0);
            Console.WriteLine("Key:{0}", key);

            String encryptorStr = RC2Crypto.Encryptor(input, key);

            Assert.IsNotNull(encryptorStr);
            Assert.IsTrue(encryptorStr.Length > 0);
            Console.WriteLine("密文:{0}", encryptorStr);

            String decryptorStr = RC2Crypto.Decryptor(encryptorStr, key);

            Assert.IsNotNull(decryptorStr);
            Assert.IsTrue(decryptorStr.Length > 0);
            Console.WriteLine("正文:{0}", decryptorStr);
            Assert.IsTrue(decryptorStr.Equals(input));
        }