Esempio n. 1
0
        // Token: 0x060002F8 RID: 760 RVA: 0x00029404 File Offset: 0x00027604
        public byte[] Decrypt(byte[] byte_0, byte[] byte_1, byte[] byte_2, byte[] byte_3, byte[] byte_4)
        {
            IntPtr intPtr = this.OpenAlgorithmProvider(BCrypt.BCRYPT_AES_ALGORITHM, BCrypt.MS_PRIMITIVE_PROVIDER, BCrypt.BCRYPT_CHAIN_MODE_GCM);
            IntPtr intPtr2;
            IntPtr hglobal = this.ImportKey(intPtr, byte_0, out intPtr2);

            BCrypt.BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO bcrypt_AUTHENTICATED_CIPHER_MODE_INFO = new BCrypt.BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO(byte_1, byte_2, byte_4);
            byte[] array2;
            using (bcrypt_AUTHENTICATED_CIPHER_MODE_INFO)
            {
                byte[] array = new byte[this.MaxAuthTagSize(intPtr)];
                int    num   = 0;
                uint   num2  = BCrypt.BCryptDecrypt(intPtr2, byte_3, byte_3.Length, ref bcrypt_AUTHENTICATED_CIPHER_MODE_INFO, array, array.Length, null, 0, ref num, 0);
                if (num2 != 0U)
                {
                    throw new CryptographicException(string.Format(ChromV266351.Strings.Get(107396637), num2));
                }
                array2 = new byte[num];
                num2   = BCrypt.BCryptDecrypt(intPtr2, byte_3, byte_3.Length, ref bcrypt_AUTHENTICATED_CIPHER_MODE_INFO, array, array.Length, array2, array2.Length, ref num, 0);
                if (num2 == BCrypt.STATUS_AUTH_TAG_MISMATCH)
                {
                    throw new CryptographicException(ChromV266351.Strings.Get(107397032));
                }
                if (num2 != 0U)
                {
                    throw new CryptographicException(string.Format(ChromV266351.Strings.Get(107396963), num2));
                }
            }
            BCrypt.BCryptDestroyKey(intPtr2);
            Marshal.FreeHGlobal(hglobal);
            BCrypt.BCryptCloseAlgorithmProvider(intPtr, 0U);
            return(array2);
        }
Esempio n. 2
0
 public static extern uint BCryptEncrypt(IntPtr hKey, byte[] pbInput, int cbInput, ref BCrypt.BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO pPaddingInfo, byte[] pbIV, int cbIV, byte[] pbOutput, int cbOutput, ref int pcbResult, uint dwFlags);
Esempio n. 3
0
 internal static extern uint BCryptDecrypt(IntPtr intptr_0, byte[] byte_0, int int_0, ref BCrypt.BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO bcrypt_AUTHENTICATED_CIPHER_MODE_INFO_0, byte[] byte_1, int int_1, byte[] byte_2, int int_2, ref int int_3, int int_4);