Example #1
0
        public static byte[] Patch(byte[] Data, string UID)
        {
            // ToDo: Fix UID Cast

            byte[] Decrypted_Amiibo;
            if (IsEncrypted(Data))
            {
                Decrypted_Amiibo = Amiibo_Class.Decrypt(Data, Main_Form.AmiiKeys);
            }
            else
            {
                Decrypted_Amiibo = Data;
            }

            byte[] Password_Amiibo = Amiibo_Class.Generate_Password(UID);
            byte[] UID_Long        = NtagHelpers.StringToByteArrayFastest(UID);

            Array.Copy(UID_Long, 0x008, Decrypted_Amiibo, 0x000, 0x001);                        //Put LastChar of Long UID
            Array.Copy(new byte[] { 0x00, 0x00 }, 0x000, Decrypted_Amiibo, 0x002, 0x002);       //Reset Static Lock Bytes
            Array.Copy(UID_Long, 0x000, Decrypted_Amiibo, 0x1D4, 0x008);                        //Modify UID
            Array.Copy(new byte[] { 0x00, 0x00, 0x00 }, 0x000, Decrypted_Amiibo, 0x208, 0x003); //Reset Dynamic Lock Bytes
            Array.Copy(Password_Amiibo, 0x000, Decrypted_Amiibo, 0x214, 0x004);                 //Modify Password
            Array.Copy(new byte[] { 0x80, 0x80 }, 0x000, Decrypted_Amiibo, 0x218, 0x002);       //Reset PACK0 & PACK1

            return(Amiibo_Class.Encrypt(Decrypted_Amiibo, Main_Form.AmiiKeys));
        }
Example #2
0
        public static byte[] WriteAppData(byte[] Data, byte[] AppData)
        {
            byte[] Decrypted_Amiibo;
            if (IsEncrypted(Data))
            {
                Decrypted_Amiibo = Amiibo_Class.Decrypt(Data, Main_Form.AmiiKeys);
            }
            else
            {
                Decrypted_Amiibo = Data;
            }

            Array.Copy(AppData, 0x000, Decrypted_Amiibo, 0x0DC, 0x0D8);

            if (IsEncrypted(Data))
            {
                return(Amiibo_Class.Encrypt(Decrypted_Amiibo, Main_Form.AmiiKeys));
            }
            else
            {
                return(Decrypted_Amiibo);
            }
        }
Example #3
0
        private void decryptToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string FileName = listView1.SelectedItems[0].Text.Trim();

            if (File_IsEncrypted(FileName))
            {
                File.WriteAllBytes(Path.Combine(Current_Folder, Path.GetFileNameWithoutExtension(FileName) + ".dec.bin"), Amiibo_Class.Decrypt(File.ReadAllBytes(Path.Combine(Current_Folder, FileName)), AmiiKeys));
            }
            else
            {
                File.WriteAllBytes(Path.Combine(Current_Folder, Path.GetFileNameWithoutExtension(FileName) + ".enc.bin"), Amiibo_Class.Encrypt(File.ReadAllBytes(Path.Combine(Current_Folder, FileName)), AmiiKeys));
            }
        }