/// <summary>
 ///
 /// </summary>
 /// <param name="s"></param>
 public void Press(string s)
 {
     OnKeyPress(s);
     Output.Append(s);
     OutputFeedback.FireUpdate();
     ResetShift();
 }
        void Clear()
        {
            OnKeyPress(KeyboardSpecialKey.Clear);

            Output.Remove(0, Output.Length);
            OutputFeedback.FireUpdate();
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="c"></param>
 public void Press(char c)
 {
     OnKeyPress(c.ToString());
     Output.Append(c);
     OutputFeedback.FireUpdate();
     ResetShift();
 }
        void Backspace()
        {
            OnKeyPress(KeyboardSpecialKey.Backspace);

            if (Output.Length > 0)
            {
                Output.Remove(Output.Length - 1, 1);
                OutputFeedback.FireUpdate();
            }
        }
Exemplo n.º 5
0
 public void ShouldCipherAndDecipherWith0InitializationVector()
 {
     // 0 initialization vector may cause smaller encrypted data size than key length
     outputFeedback = new OutputFeedback(rsa, 0);
     byte[] data =
     {
         208,  59, 152, 15, 20,  5, 233, 119, 22, 58, 9, 128, 253, 33, 212, 58, 184, 80, 242, 239, 193, 150, 177,
         195, 179,  68, 23, 13, 14, 162, 131, 226
     };
     byte[] cipheredData   = outputFeedback.Cipher(data);
     byte[] decipheredData = outputFeedback.Decipher(cipheredData);
     Assert.AreEqual(data, decipheredData);
 }
Exemplo n.º 6
0
        public void ShouldCipherAndDecipherByteArrayUsingRandomBlocks()
        {
            Random random = new Random();

            outputFeedback = new OutputFeedback(rsa, 0);
            for (int i = 0; i < 1000; i++)
            {
                byte[] data = new byte[random.Next(64, 96)];
                random.NextBytes(data);
                byte[] cipheredData   = outputFeedback.Cipher(data);
                byte[] decipheredData = outputFeedback.Decipher(cipheredData);
                Assert.AreEqual(data, decipheredData);
            }
        }
Exemplo n.º 7
0
 public void Setup()
 {
     rsa              = new MyRSA(1024);
     outputFeedback   = new OutputFeedback(rsa);
     imageBlockCipher = new ImageBlockCipher(outputFeedback);
 }