Exemple #1
0
        /// <summary>
        /// Build the decrypted title key based on title id bytes.
        /// </summary>
        private void DecryptTitleKey()
        {
            this.IV = new byte[0x10];
            Array.Copy(this.TitleIdBytes, 0, this.IV, 0, 8);

            switch (this.CommonKeyIndex)
            {
            case 1:
                if (this.KoreanCommonKey == null)
                {
                    this.KoreanCommonKey = NintendoWiiOpticalDisc.GetKeyFromFile(NintendoWiiOpticalDisc.KOREAN_KEY_PATH);
                }

                this.DecryptedTitleKey = AESEngine.Decrypt(this.EncryptedTitleKey,
                                                           this.KoreanCommonKey, this.IV,
                                                           CipherMode.CBC, PaddingMode.Zeros);

                break;

            case 0:
            default:
                if (this.CommonKey == null)
                {
                    this.CommonKey = NintendoWiiOpticalDisc.GetKeyFromFile(NintendoWiiOpticalDisc.COMMON_KEY_PATH);
                }

                this.DecryptedTitleKey = AESEngine.Decrypt(this.EncryptedTitleKey,
                                                           this.CommonKey, this.IV,
                                                           CipherMode.CBC, PaddingMode.Zeros);

                break;
            } // switch (this.CommonKeyIndex)
        }
        public ConnectionFactory()
        {
            //Simplify this code
            var builder = new ConfigurationBuilder()
                          .SetBasePath(Directory.GetCurrentDirectory())
                          .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);
            IConfigurationRoot configuration = builder.Build();

            encryptedConnectionString = configuration["AppSettings:ConnectionString"];
            connectionString          = AESEngine.Decrypt(encryptedConnectionString);
        }