Beispiel #1
0
 private void UpdateIndentityToSecurityLevel(int targetLevel)
 {
     if (Ts3Crypt.GetSecurityLevel(identity) < targetLevel)
     {
         Log.Info("Calculating up to required security level: {0}", targetLevel);
         Ts3Crypt.ImproveSecurity(identity, targetLevel);
         config.Connect.Identity.Offset.Value = identity.ValidKeyOffset;
     }
 }
Beispiel #2
0
 private void UpdateIndentityToSecurityLevel(int targetLevel)
 {
     if (Ts3Crypt.GetSecurityLevel(identity) < targetLevel)
     {
         Log.Info("Calculating up to required security level: {0}", targetLevel);
         Ts3Crypt.ImproveSecurity(identity, targetLevel);
         ts3FullClientData.IdentityOffset = identity.ValidKeyOffset;
     }
 }
Beispiel #3
0
        public override void Connect()
        {
            // get or compute identity
            if (string.IsNullOrEmpty(ts3FullClientData.Identity))
            {
                identity = Ts3Crypt.GenerateNewIdentity();
                ts3FullClientData.Identity       = identity.PrivateKeyString;
                ts3FullClientData.IdentityOffset = identity.ValidKeyOffset;
            }
            else
            {
                identity = Ts3Crypt.LoadIdentity(ts3FullClientData.Identity, ts3FullClientData.IdentityOffset);
            }

            // check required security level
            if (ts3FullClientData.IdentityLevel == "auto")
            {
            }
            else if (int.TryParse(ts3FullClientData.IdentityLevel, out int targetLevel))
            {
                if (Ts3Crypt.GetSecurityLevel(identity) < targetLevel)
                {
                    Log.Info("Calculating up to required security level: {0}", targetLevel);
                    Ts3Crypt.ImproveSecurity(identity, targetLevel);
                    ts3FullClientData.IdentityOffset = identity.ValidKeyOffset;
                }
            }
            else
            {
                Log.Warn("Invalid value for QueryConnection::IdentityLevel, enter a number or \"auto\".");
            }


            // get or compute password
            if (!string.IsNullOrEmpty(ts3FullClientData.ServerPassword) &&
                ts3FullClientData.ServerPasswordAutoHash &&
                !ts3FullClientData.ServerPasswordIsHashed)
            {
                ts3FullClientData.ServerPassword         = Ts3Crypt.HashPassword(ts3FullClientData.ServerPassword);
                ts3FullClientData.ServerPasswordIsHashed = true;
            }

            tsFullClient.QuitMessage     = QuitMessages[Util.Random.Next(0, QuitMessages.Length)];
            tsFullClient.OnErrorEvent   += TsFullClient_OnErrorEvent;
            tsFullClient.OnDisconnected += TsFullClient_OnDisconnected;
            ConnectClient();
        }