Beispiel #1
0
        private void DeriveKeyblobKeys()
        {
            if (SecureBootKey.IsEmpty() || TsecKey.IsEmpty())
            {
                return;
            }

            bool haveKeyblobMacKeySource = !MasterKeySource.IsEmpty();
            var  temp = new byte[0x10];

            for (int i = 0; i < UsedKeyblobCount; i++)
            {
                if (KeyblobKeySources[i].IsEmpty())
                {
                    continue;
                }

                Crypto.DecryptEcb(TsecKey, KeyblobKeySources[i], temp, 0x10);
                Crypto.DecryptEcb(SecureBootKey, temp, KeyblobKeys[i], 0x10);

                if (!haveKeyblobMacKeySource)
                {
                    continue;
                }

                Crypto.DecryptEcb(KeyblobKeys[i], KeyblobMacKeySource, KeyblobMacKeys[i], 0x10);
            }
        }
Beispiel #2
0
        private void ReadKeyblobs()
        {
            var masterKek = new byte[0x10];

            bool haveMasterKeySource = !MasterKeySource.IsEmpty();

            for (int i = 0; i < 0x20; i++)
            {
                if (Keyblobs[i].IsEmpty())
                {
                    continue;
                }

                Array.Copy(Keyblobs[i], 0x80, Package1Keys[i], 0, 0x10);

                if (!haveMasterKeySource)
                {
                    continue;
                }

                Array.Copy(Keyblobs[i], masterKek, 0x10);

                Crypto.DecryptEcb(masterKek, MasterKeySource, MasterKeys[i], 0x10);
            }
        }
Beispiel #3
0
        private void DeriveMasterKeys()
        {
            if (MasterKeySource.IsEmpty())
            {
                return;
            }

            for (int i = 0; i < 0x20; i++)
            {
                if (MasterKeks[i].IsEmpty())
                {
                    continue;
                }

                Crypto.DecryptEcb(MasterKeks[i], MasterKeySource, MasterKeys[i], 0x10);
            }
        }