Exemple #1
0
        public ServiceManager()
        {
            _aes = new Aes();
            _rsa = new Rsa();
            _rsa.SetKey(ConfigurationManager.AppSettings["RsaXmlPublicKey"]);
            var _timer = new DispatcherTimer();

            _timer.Tick    += Reconnect;
            _timer.Interval = TimeSpan.FromSeconds(2);
            _client         = new MessengerClient();
            Connect();
        }
Exemple #2
0
 private void Connect()
 {
     try
     {
         var encryptedKey = _rsa.GenerateNewAes256EncryptedKey(out var key);
         _client.SetEncryptedSessionKey(encryptedKey);
         _aes.SetAesKey(key);
         Aes         = _aes;
         IsConnected = true;
     }
     catch
     {
         return;
     }
 }