Exemple #1
0
 public static string DecryptString(string encryptedText, CryptoArgs args)
 {
     return(RijndaelSimple.Decrypt(encryptedText,
                                   args.PassPhrase,
                                   args.SaltValue,
                                   args.HashAlgorithm,
                                   args.PasswordIterations,
                                   args.InitVector,
                                   args.KeySize));
 }
Exemple #2
0
        private void btnEncrypt_Click(object sender, EventArgs e)
        {
            StringBuilder contents = new StringBuilder();

            contents.Append(rtbFile.Text);
            string contentsToString = contents.ToString();

            rtbFile.Clear();
            rtbFile.Text = RijndaelSimple.Encrypt(contentsToString, "Bananas", "LeagueOfLegends", "SHA1", 2, "1234567890123456", 192);
        }
        public OracleDataImport(Landing_Table Table, int ExecutionId, LandingRepository Repository)
        {
            String password = RijndaelSimple.Decrypt(Table.Source_Pass, "passPhrase", "saltValue", "SHA1", 1, "initVector", 128);

            repo = Repository;

            this.Table             = Table;
            sourceConnectionString = "Provider=OraOLEDB.Oracle; Data Source=" + Table.Source_DB + ".world; User Id=" + Table.Source_User + "; Password="******";";

            tableName        = TableName;
            this.ExecutionId = ExecutionId;
        }
Exemple #4
0
        static void Main(string[] args)
        {
            string input = "";

            Console.Write("Ingrese el valor a desencriptar: ");
            input = Console.ReadLine();

            string resultado = RijndaelSimple.Encriptar(input);

            Console.WriteLine("La contraseña desencriptada es: " + resultado);
            Console.ReadLine();
        }
Exemple #5
0
        protected override byte[] SaveFilter(byte[] data)
        {
            if (_key == null || _key.Length == 0)
            {
                throw new CryptographicException("Key not set");
            }

            var aes = new RijndaelSimple(_key);

            data = aes.Encrypt(data, 256);
            return(base.SaveFilter(data));
        }
Exemple #6
0
            /// <summary>
            /// Decrypts a string
            /// </summary>
            /// <param name="text">String to be decrypted</param>
            /// <returns>Decrypted string</returns>
            public string Decrypt(string text)
            {
                try
                {
                    if (!string.IsNullOrEmpty(text))
                    {
                        return(RijndaelSimple.Decrypt(text, PassPhrase, Salt, "SHA1", 2, IV16Chars, 256));
                    }

                    return(text);
                }
                catch { return(text); }
            }
Exemple #7
0
        int keySize            = 256;                // can be 192 or 128

        private void backupBtn_Click(object sender, EventArgs e)
        {
            string fileName = "C:\\DBBackup\\PatientDatabase.sql";

            if (!Directory.Exists("C:\\DBBackup"))
            {
                Directory.CreateDirectory("C:\\DBBackup");
            }

            if (File.Exists(fileName))
            {
                DialogResult confirmation = new DialogResult();
                confirmation = MessageBox.Show("A backup file already exists. Overwrite?", "ATTENTION", MessageBoxButtons.YesNo);
                if (confirmation == DialogResult.Yes)
                {
                    using (MySqlConnection connection = DatabaseConnection.GetConnection())
                    {
                        using (MySqlCommand cmd = new MySqlCommand())
                        {
                            using (MySqlBackup backup = new MySqlBackup(cmd))
                            {
                                cmd.Connection = connection;
                                connection.Open();
                                backup.ExportToFile(fileName);
                                connection.Close();
                                string wholeFile = RijndaelSimple.Encrypt(File.ReadAllText(fileName), passPhrase, saltValue, hashAlgorithm, passwordIterations, initVector, keySize);
                                File.WriteAllText(fileName, wholeFile);
                            }
                        }
                    }
                }
            }
            else
            {
                using (MySqlConnection connection = DatabaseConnection.GetConnection())
                {
                    using (MySqlCommand cmd = new MySqlCommand())
                    {
                        using (MySqlBackup backup = new MySqlBackup(cmd))
                        {
                            cmd.Connection = connection;
                            connection.Open();
                            backup.ExportToFile(fileName);
                            connection.Close();
                            string wholeFile = RijndaelSimple.Encrypt(File.ReadAllText(fileName), passPhrase, saltValue, hashAlgorithm, passwordIterations, initVector, keySize);
                            File.WriteAllText(fileName, wholeFile);
                        }
                    }
                }
            }
        }
Exemple #8
0
        static void Main(string[] args)
        {
            LandingRepository repo = new LandingRepository();

            logger.Info("~~~~ Program Started ~~~~");

            List <Landing_Table> import_tables = repo.GetLandingTables();

            foreach (Landing_Table table in import_tables)
            {
                logger.Info("Importing {0}", table.Table_Name);
                Landing_Table_Log TableLog = repo.New_Log_Record(table.id);

                try
                {
                    String password = RijndaelSimple.Decrypt(table.Source_Pass, "PLanning and Audit", "Diplomatic Persistance", "SHA1", 1, "AGHYEFIVOPJNSFRU", 128);

                    if (repo.TableExists(table.Dest_Schema, table.Table_Name))
                    {
                        logger.Debug("Table {0}.{1} exists", table.Dest_Schema, table.Table_Name);
                    }
                    else
                    {
                        logger.Debug("Table {0}.{1} does not exist", table.Dest_Schema, table.Table_Name);
                    }


                    TableLog.Start_Time = DateTime.Now;
                    TableLog.Success    = 0;
                    repo.Update_Log(TableLog);
                } catch (Exception ex)
                {
                    TableLog.Notes = "Exception: " + ex.Message;
                    logger.Error(ex, "Error loading table " + table.Table_Name);
                } finally
                {
                    logger.Info("Finished {0}", table.Table_Name);
                    TableLog.End_Time = DateTime.Now;
                    repo.Update_Log(TableLog);
                }
            }


            logger.Info("~~~~ Program Finished ~~~~");


            //System.Console.ReadKey();
            LogManager.Flush();
            LogManager.Shutdown();
        }
Exemple #9
0
        protected string Encrypt()
        {
            var    plainText = _builder.ToString();
            string encrypted = RijndaelSimple.Encrypt(plainText, Passphrase, SaltValue, "SHA1", 1, InitVector, 256);

            string  log;
            Huffman h    = new Huffman(plainText);
            var     hash = h.Encode(out log);
            string  e    = string.Empty;

            foreach (var b in hash)
            {
                e += b.ToString("x2").ToLower();
            }
            return("r4dio:" + TrackSource + ":" + e);
        }
Exemple #10
0
 /// <summary>
 /// Decrypt a byte array that was encrypted using the Rinjdael encryption algorithm.
 /// </summary>
 /// <param name="data">The encrypted data.</param>
 /// <param name="key">The key to decrypt with.</param>
 static public byte[] Decrypt(byte[] data, string key)
 {
     try
     {
         return RijndaelSimple.Decrypt(data,
                                        key,
                                        saltValue,
                                        hashAlgorithm,
                                        passwordIterations,
                                        initVector,
                                        keySize);
     }
     catch (Exception e)
     {
         throw new Exception("Rinjdael \"Decrypt()\": " + e.Message);
     }
 }
Exemple #11
0
        private static void Main(string[] args)
        {
            string outputFile;

            if (args.Length == 0 || args.Length > 2)
            {
                Console.WriteLine("Usage: WofEncrypter.exe inputFilename [-d]");
                Console.WriteLine("Encodes file to inputFilename.dat");
                return;
            }
            string filename = args[0];
            bool   decrypt  = false;

            if (args.Length == 2)
            {
                if (!args[1].Equals("-d"))
                {
                    Console.WriteLine("Usage: WofEncrypter.exe inputFilename [-d]");
                    Console.WriteLine("Encodes file to inputFilename.dat");
                    return;
                }
                decrypt    = true;
                outputFile = filename.Substring(0, filename.LastIndexOf('.')) + ".plain";
            }
            else
            {
                outputFile = filename.Substring(0, filename.LastIndexOf('.')) + ".dat";
            }


            if (!File.Exists(filename))
            {
                MessageBox.Show("File '" + filename + "' does not exist");
                return;
            }
            string raw = File.ReadAllText(args[0]);

            if (decrypt)
            {
                File.WriteAllText(outputFile, RijndaelSimple.Decrypt(raw));
            }
            else
            {
                File.WriteAllText(outputFile, RijndaelSimple.Encrypt(raw));
            }
        }
Exemple #12
0
        public static bool BuildLicenseFile(string inputHash)
        {
            string encrypted = RijndaelSimple.Encrypt(C_ENHANCED_VERSION_LICENSE, inputHash, RijndaelSimple.saltValue,
                                                      RijndaelSimple.hashAlgorithm, RijndaelSimple.passwordIterations,
                                                      RijndaelSimple.initVector, RijndaelSimple.keySize);



            string desEncryptedHash = RijndaelSimple.AES_encrypt(inputHash, RijndaelSimple.AES_Key, RijndaelSimple.AES_IV);
            string licenseKey       = desEncryptedHash.Substring(0, 32);

            string encryptedLicense = RijndaelSimple.AES_encrypt(C_ENHANCED_VERSION_LICENSE, licenseKey, RijndaelSimple.AES_IV);

            File.WriteAllText(C_LICENSE_FILE, encrypted + "\r\n" + desEncryptedHash + "\r\n" + encryptedLicense); // pojedyncza licencja

            return(true);
        }
Exemple #13
0
        private static string Decrypt(string encryptedText, string encryptionKey, string salt)
        {
            if (string.IsNullOrEmpty(encryptedText))
            {
                return(null);
            }
            if (string.IsNullOrEmpty(encryptionKey))
            {
                throw new ArgumentNullException(nameof(encryptionKey));
            }
            if (string.IsNullOrEmpty(salt))
            {
                throw new ArgumentNullException(nameof(salt));
            }

            return(RijndaelSimple.SHA1Decrypt(encryptedText, encryptionKey, salt, IV));
        }
Exemple #14
0
        public override void LoadFrom(string path)
        {
            if (File.Exists(path))
            {
                try
                {
                    byte[] file = RijndaelSimple.DecryptFile(File.ReadAllBytes(path), password, saltValue, AesHashType.MD5.ToString(), passwordIterations, initVector, (int)AesKeySize.Size128);

                    try
                    {
                        using (MemoryStream ms = new MemoryStream(file))
                        {
                            XmlTextReader xr = new XmlTextReader(ms);
                            XmlSerializer xs = new XmlSerializer(this.GetType());
                            object        c;
                            if (xs.CanDeserialize(xr))
                            {
                                c = xs.Deserialize(xr);
                                Type           t          = this.GetType();
                                PropertyInfo[] properties = t.GetProperties();
                                foreach (PropertyInfo p in properties)
                                {
                                    p.SetValue(this, p.GetValue(c, null), null);
                                }
                                Encode(c);
                            }

                            xr.Close();
                            ms.Close();
                        }
                    }
                    catch
                    {
                        throw;
                    }
                }
                catch
                {
                    throw new System.Security.Cryptography.CryptographicException("Could not decrypt file!");
                }
            }
            else
            {
                throw new FileNotFoundException();
            }
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            string encryptedUsername = RijndaelSimple.Encrypt <RijndaelManaged>(tboxUsername.Text, "username", "salt");
            string encryptedPassword = RijndaelSimple.Encrypt <RijndaelManaged>(tboxPassword.Text, "password", "salt");

            if (encryptedUsername != Properties.Settings.Default.Username || encryptedPassword != Properties.Settings.Default.Password)
            {
                Properties.Settings.Default.Username = encryptedUsername;
                Properties.Settings.Default.Password = encryptedPassword;
                Properties.Settings.Default.Save();
                RiverLinkLogic.runHeadless = true;
                lblTest.Text      = "Testing Password...";
                lblTest.ForeColor = Color.Blue;
                lblTest.Visible   = true;
                backgroundWorker1.RunWorkerAsync();
            }
        }
Exemple #16
0
        public override void SaveAs(string path)
        {
            using (MemoryStream ms = new MemoryStream())
            {
                XmlSerializer s = new XmlSerializer(this.GetType());
                Encode(this);
                s.Serialize(ms, this);
                Decode(this);

                Byte[] file = ms.ToArray();
                ms.Close();
                file = RijndaelSimple.EncryptFile(file, password, saltValue, AesHashType.MD5.ToString(), passwordIterations, initVector, (int)AesKeySize.Size128);

                FileStream fs = new FileStream(path, FileMode.CreateNew);
                fs.Write(file, 0, file.Length);
                fs.Close();
            }
        }
Exemple #17
0
        public float GetSurvivalTime()
        {
            if (!File.Exists(EngineConfig.C_SURVIVAL_FILE))
            {
                return(0);
            }

            string raw = File.ReadAllText(EngineConfig.C_SURVIVAL_FILE);

            try
            {
                return(float.Parse(RijndaelSimple.Decrypt(raw)));
            }
            catch (Exception)
            {
                return(0);
            }
        }
Exemple #18
0
        private void Read()
        {
            // automatically reencode XML file to DAT file
            if (EngineConfig.AutoEncodeXMLs && File.Exists(RAWTilesPath))
            {
                File.WriteAllText(TilesPath, RijndaelSimple.Encrypt(File.ReadAllText(RAWTilesPath)));
            }

            if (!File.Exists(TilesPath))
            {
                throw new TilesFileNotFoundException(Path.GetFileName(TilesPath));
            }


            try
            {
                string            contents = RijndaelSimple.Decrypt(File.ReadAllText(TilesPath));
                XmlReaderSettings settings = new XmlReaderSettings();
                settings.IgnoreComments   = true;
                settings.IgnoreWhitespace = true;
                using (XmlReader reader = XmlReader.Create(new StringReader(contents), settings))
                {
                    NumberFormatInfo format = new NumberFormatInfo();
                    format.NumberGroupSeparator = ",";
                    while (reader.Read())
                    {
                        // Process only the elements
                        if (reader.NodeType == XmlNodeType.Element)
                        {
                            if (reader.Name.Equals(Nodes.Tile))
                            {
                                ReadTile(reader, format);
                            }
                        }
                    }
                    reader.Close();
                }
                isOkRead = true;
            }
            catch
            {
                isOkRead = false;
            }
        }
Exemple #19
0
        public List <HighscoreEntry> LoadList()
        {
            List <HighscoreEntry> highscores = new List <HighscoreEntry>();

            if (!File.Exists(EngineConfig.C_HIGHSCORES_FILE))
            {
                highscores = CreateDefaultHighscores();
                string scores = "";
                for (int i = 0; i < 10; i++)
                {
                    scores += "|" + highscores[i].ToString();
                }
                File.WriteAllText(EngineConfig.C_HIGHSCORES_FILE, RijndaelSimple.Encrypt(scores));
            }
            else
            {
                try
                {
                    string   raw    = File.ReadAllText(EngineConfig.C_HIGHSCORES_FILE);
                    string[] scores =
                        RijndaelSimple.Decrypt(raw).Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);


                    for (int i = 0; i < scores.Length; i++)
                    {
                        highscores.Add(new HighscoreEntry(scores[i]));
                    }
                }
                catch (Exception)
                {
                    try
                    {
                        File.Delete(EngineConfig.C_HIGHSCORES_FILE);
                        return(LoadList());
                    }
                    catch (Exception)
                    {
                    }
                }
            }

            return(highscores);
        }
Exemple #20
0
        public static MySqlConnection GetConnection()
        {
            //conn is an object of the "MySqlConnection" class. It will be returned to other C# classes
            // it can be referenced in other classes to provide a connection to the database where needed
            //For example, a function containing a query on the DB
            string connectionString;
            string passPhrase         = "Pas5pr@se";        // can be any string
            string saltValue          = "s@1tValue";        // can be any string
            string hashAlgorithm      = "SHA1";             // can be "MD5"
            int    passwordIterations = 2;                  // can be any number
            string initVector         = "@1B2c3D4e5F6g7H8"; // must be 16 bytes
            int    keySize            = 256;                // can be 192 or 128
            string fileName           = "C:\\DBBackup\\stored.dat";
            String password           = RijndaelSimple.Decrypt(File.ReadAllText(fileName), passPhrase, saltValue, hashAlgorithm, passwordIterations, initVector, keySize);

            connectionString = "SERVER=localhost; DATABASE =dhrp; USERNAME=nomawkellner; Password=" + password;
            MySqlConnection conn = new MySqlConnection(connectionString);

            return(conn);
        }
        /// <summary>
        /// Wczytuje konfiguracje z podanego pliku.
        /// </summary>
        /// <param name="path">Sciezka do pliku zawierajacego konfiguracje lementow gry.</param>
        /// <param name="isCryptData">Czy dane sa zaszyfrowane.</param>
        public ReadConfiguration(string path, bool isCryptData)
        {
            if (String.IsNullOrEmpty(path))
            {
                throw new ArgumentException(String.Format("Podana sciezka: {0} nie istnieje !", path), "path");
            }
            if (!File.Exists(path))
            {
                throw new ConfigurationFileNotFoundException(Path.GetFileName(path));
            }

            Init();
            if (isCryptData)
            {
                ReadFile(XmlTextReader.Create(new StringReader(RijndaelSimple.Decrypt(File.ReadAllText(path)))));
            }
            else
            {
                ReadFile(XmlReader.Create(new XmlTextReader(path), GetSettings()));
            }
        }
Exemple #22
0
        internal string Save(string fileName, string settings)
        {
            try {
                string[] args = settings.Split('\n');

                string fullPath = Methods.Instance.GetApplicationPath + fileName;

                if (File.Exists(fullPath))
                {
                    File.Delete(fullPath);
                }

                using (var tw = new StreamWriter(fullPath)) {
                    args.ToList().ForEach(s => tw.WriteLine(RijndaelSimple.Encrypt(s.Trim())));
                }
                return("Settings saved.");
            }
            catch {
                return("Unable to save settings.");
            }
        }
Exemple #23
0
        public static CompletedLevelsInfo GetCompletedLevels()
        {
            CompletedLevelsInfo completedLevels = new CompletedLevelsInfo();

            completedLevels.CompletedLevels = new SerializableDictionary <LevelInfo, List <Achievement> >();

            List <Achievement> emptyAchievements = new List <Achievement>();

            if (!File.Exists(EngineConfig.C_COMPLETED_LEVELS_FILE))
            {
                completedLevels = CompletedLevelsInfo.GetDefaultCompletedLevelsInfo();
                return(completedLevels);
            }
            else
            {
                try
                {
                    string levelsRaw    = File.ReadAllText(EngineConfig.C_COMPLETED_LEVELS_FILE);
                    string levelsString = RijndaelSimple.Decrypt(levelsRaw);

                    using (Stream stream = GenerateStreamFromString(levelsString))
                    {
                        XmlSerializer serializer = new XmlSerializer(typeof(CompletedLevelsInfo));
                        ;
                        var levels = ( CompletedLevelsInfo)serializer.Deserialize(stream);
                        return(levels as CompletedLevelsInfo);
                    }
                }
                catch (Exception ex)
                {
                    completedLevels.CompletedLevels.Clear();
                    completedLevels.CompletedLevels.Add(new LevelInfo(XmlLevelParser.GetLevelFileName(1), false), emptyAchievements);
                    Console.WriteLine(ex);
                }


                return(completedLevels);
            }
        }
Exemple #24
0
        internal List <String> Load(string fileName)
        {
            string fullPath = Methods.Instance.GetApplicationPath + fileName;

            if (File.Exists(fullPath))
            {
                string input;
                var    args = new List <String>();

                using (var tr = new StreamReader(fullPath)) {
                    while ((input = tr.ReadLine()) != null)
                    {
                        if (input != null)
                        {
                            args.Add(RijndaelSimple.Decrypt(input));
                        }
                    }
                }
                return(args);
            }
            return(null);
        }
Exemple #25
0
    static void Main(string[] args)
    {
        string plainText = "Hello, World!";               // original plaintext

        string passPhrase         = "Kes0pr@se";          // can be any string
        string saltValue          = "V@1tValue";          // can be any string
        string hashAlgorithm      = "SHA1";               // can be "MD5"
        int    passwordIterations = 3;                    // can be any number
        string initVector         = "@1B2c3D4e5F6g7H8";   // must be 16 bytes
        int    keySize            = 256;                  // can be 192 or 128

        Console.WriteLine(String.Format("Plaintext : {0}", plainText));

        string cipherText = RijndaelSimple.Encrypt
                            (
            plainText,
            passPhrase,
            saltValue,
            hashAlgorithm,
            passwordIterations,
            initVector,
            keySize
                            );

        Console.WriteLine(String.Format("Encrypted : {0}", cipherText));

        plainText = RijndaelSimple.Decrypt
                    (
            cipherText,
            passPhrase,
            saltValue,
            hashAlgorithm,
            passwordIterations,
            initVector,
            keySize
                    );

        Console.WriteLine(String.Format("Decrypted : {0}", plainText));
    }
Exemple #26
0
        public Pair <string, string> EncryptDecryptPassword(string passwordVal, string saltVal)
        {
            Pair <string, string> item = new Pair <string, string>();

            if (saltVal == String.Empty)
            {
                item.Item1 = CSEncryption.CreateSalt(4);
            }
            else
            {
                item.Item1 = saltVal;
            }
            item.Item2 = RijndaelSimple.Encrypt(passwordVal,
                                                ConfigHelper.ReadAppSetting("PassPhrase", ""),
                                                item.Item1,
                                                "SHA1",
                                                2,
                                                "@1B2c3D4e5F6g7H8",
                                                256);
            //item.Item2 =   CSEncryption.CreatePasswordHash(passwordVal, saltVal, "SHA1");
            return(item);
        }
Exemple #27
0
        public static CompletedLevelsInfo NewLevelCompleted(LevelInfo levelInfo, List <Achievement> achievements)
        {
            CompletedLevelsInfo completedLevels = Singleton.CompletedLevelsInfo;

            completedLevels.CompletedLevels[levelInfo] = achievements;


            MemoryStream  stream     = new MemoryStream();
            XmlSerializer serializer = new XmlSerializer(typeof(CompletedLevelsInfo));

            serializer.Serialize(stream, completedLevels);

            stream.Position = 0;
            var sr        = new StreamReader(stream);
            var levelsRaw = sr.ReadToEnd();

            stream.Close();

            File.WriteAllText(EngineConfig.C_COMPLETED_LEVELS_FILE, RijndaelSimple.Encrypt(levelsRaw));

            Singleton.UpdateCompletedLevelsInfo(completedLevels);
            return(completedLevels);
        }
Exemple #28
0
        protected void Decrypt(string trackLinkUri)
        {
            Uri = trackLinkUri;

            string[] parts = trackLinkUri.Split(new[] { ':' }, StringSplitOptions.RemoveEmptyEntries);

            if (parts.Length != 3)
            {
                throw new InvalidOperationException("Unable to parse link");
            }

            TrackSource = parts[1];

            string encrypted = parts[2];
            string decrypted = RijndaelSimple.Decrypt(encrypted, Passphrase, SaltValue, "SHA1", 1, InitVector, 256);

            var result = HttpUtility.ParseQueryString(decrypted);

            foreach (string key in result.AllKeys)
            {
                _builder.Add(key, result[key]);
            }
        }
Exemple #29
0
        public Verify Create(TimeSpan expireDate, EnumDefine.VerifyTypeEnum type, object model)
        {
            OtpUtility     otpUtility     = new OtpUtility();
            RijndaelSimple rijndaelSimple = new RijndaelSimple();

            Id = Common.Common.GenerateGuid();
            OtpHashMode otpHashMode = OtpHashMode.Sha512;

            SaltKey        = Common.Common.GenerateNonce();
            SecretKey      = otpUtility.GenerateRandomKey(otpHashMode);
            CreatedDateUtc = Extensions.GetCurrentDateUtc();
            ExpireDate     = CreatedDateUtc.Add(expireDate);
            Type           = type;
            VerifyCode     = otpUtility.GenerateOtp(SecretKey, (int)expireDate.TotalSeconds, otpHashMode, 8);
            Model          = model;
            Status         = EnumDefine.VerifyStatusEnum.New;
            UpdatedDateUtc = CreatedDateUtc;
            CreatedUid     = string.Empty;
            UpdatedUid     = string.Empty;
            string code = UnicodeUtility.ToHexString(rijndaelSimple.Encrypt(VerifyCode, SaltKey));

            VerifyUrl = $"{ConfigSettingEnum.VerifyUrl.GetConfig()}?verify={Id}&code={code}";
            return(this);
        }
Exemple #30
0
        public void RegisterHighscore(HighscoreEntry highscoreEntry)
        {
            List <HighscoreEntry> highscores = LoadList();

            for (int i = 0; i < highscores.Count; i++)
            {
                HighscoreEntry current = highscores[i];
                if (current.Score <= highscoreEntry.Score)
                {
                    highscores.Insert(i, highscoreEntry);
                    break;
                }
            }

            highscores.RemoveAt(highscores.Count - 1);

            string scores = "";

            for (int i = 0; i < highscores.Count; i++)
            {
                scores += "|" + highscores[i].ToString();
            }
            File.WriteAllText(EngineConfig.C_HIGHSCORES_FILE, RijndaelSimple.Encrypt(scores));
        }