public void ChangePassword(string oldPassword, string newPassword)
        {
            SettingComponent sComponent = new SettingComponent();
            var setting = sComponent.GetSetting();

            if (MD5Helper.EncryptTo32(oldPassword) == setting.PassCiphertext)
            {
                AccountDac adac   = new AccountDac();
                var        aclist = adac.SelectAll();
                foreach (var item in aclist)
                {
                    item.PrivateKey = AES128.Decrypt(item.PrivateKey, oldPassword);
                    item.PrivateKey = AES128.Encrypt(item.PrivateKey, newPassword);
                }
                try
                {
                    var rows = adac.UpdatePrivateKeyAr(aclist);
                    if (rows > -1)
                    {
                        setting                = sComponent.GetSetting();
                        setting.Encrypt        = true;
                        setting.PassCiphertext = MD5Helper.EncryptTo32(newPassword);
                        sComponent.SaveSetting(setting);
                    }
                }
                catch (Exception ex)
                {
                    throw new CommonException(ErrorCode.Engine.Wallet.DB.EXECUTE_SQL_ERROR, ex);
                }
            }
            else
            {
                throw new CommonException(ErrorCode.Engine.Wallet.CHECK_PASSWORD_ERROR);
            }
        }
        public bool EncryptWallet(string salt)
        {
            bool       result = false;
            AccountDac adac   = new AccountDac();
            var        aclist = adac.SelectAll();

            foreach (var item in aclist)
            {
                item.PrivateKey = AES128.Encrypt(item.PrivateKey, salt);
            }
            try
            {
                var rows = adac.UpdatePrivateKeyAr(aclist);
                if (rows > -1)
                {
                    SettingComponent sComponent = new SettingComponent();
                    var setting = sComponent.GetSetting();
                    setting.Encrypt        = true;
                    setting.PassCiphertext = MD5Helper.EncryptTo32(salt);
                    sComponent.SaveSetting(setting);
                    result = true;
                }
            }
            catch (Exception ex)
            {
                throw new CommonException(ErrorCode.Engine.Wallet.DB.EXECUTE_SQL_ERROR, ex);
            }
            return(result);
        }
        public bool CheckPassword(string password)
        {
            SettingComponent sComponent = new SettingComponent();
            var setting = sComponent.GetSetting();

            if (MD5Helper.EncryptTo32(password) == setting.PassCiphertext)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }