public void TestRSAKeyGeneration()
        {
            EncryptionManager manager = EncryptionManager.Instance;
            KeyPair           keyPair = manager.GenerateKeyPair("HelloBumStinkInTheFace");

            string mess = manager.EncryptStringMessage("ByeBumStinkInTheFace", keyPair.PublicKey);

            mess = manager.DecryptStringMessage(mess, keyPair.PrivateKey);

            Assert.AreEqual("ByeBumStinkInTheFace", mess);
        }
Example #2
0
 public override void Start()
 {
     EncryptionManager.GenerateKeyPair(BitConverter.GetBytes(new Random().Next()));
     EncryptionManager.Start();
     while (true)
     {
         try
         {
             lock (DataManager)
                 Tick();
         }
         catch (Exception e)
         {
             Console.WriteLine("ERROR: " + e);
         }
         Thread.Sleep(TimeSpan.FromMilliseconds(10));
     }
 }
Example #3
0
 public virtual void Start()
 {
     EncryptionManager.GenerateKeyPair(BitConverter.GetBytes(ConnectionManager.Address.GetHashCode()));
     EncryptionManager.Start();
     while (true)
     {
         try
         {
             lock (DataManager)
                 Tick();
         }
         catch (Exception e)
         {
             Console.WriteLine("ERROR: " + e);
         }
         Thread.Sleep(TimeSpan.FromMilliseconds(10));
     }
 }