Beispiel #1
0
        public static AmiiboKeys LoadKeys(string path)
        {
            if (!File.Exists(path))
            {
                return(null);
            }

            try
            {
                using (var reader = new BinaryReader(File.OpenRead(path)))
                {
                    var result = AmiiboKeys.Unserialize(reader);

                    if ((result.data.magicBytesSize > 16) || (result.tag.magicBytesSize > 16))
                    {
                        return(null);
                    }

                    return(result);
                }
            }
            catch
            {
                return(null);
            }
        }
Beispiel #2
0
        private void LoadAmiiboKey()
        {
            if (Helper_Class.ValidSHA1(File.ReadAllBytes(Config.KeyFile_Path), Amiibo_Keys_Hash))
            {
                AmiiKeys = AmiiboKeys.LoadKeys(Config.KeyFile_Path);
                splitContainer1.Visible = true;
            }
            else
            {
                Config.KeyFile_Path = null;
                File.WriteAllText(AmiiBomb_Config_File, JsonConvert.SerializeObject(Config));

                AskAmiiboKey();
            }
        }
Beispiel #3
0
 public static byte[] Encrypt(byte[] Data, AmiiboKeys Keyfile)
 {
     byte[] Encrypted = new byte[NtagHelpers.NFC3D_NTAG_SIZE];
     Keyfile.Pack(Data, Encrypted);
     return(Encrypted);
 }
Beispiel #4
0
 public static byte[] Decrypt(byte[] Data, AmiiboKeys Keyfile)
 {
     byte[] Decrypted = new byte[NtagHelpers.NFC3D_AMIIBO_SIZE];
     Keyfile.Unpack(Data, Decrypted);
     return(Decrypted);
 }