Example #1
0
        // Token: 0x0600014E RID: 334 RVA: 0x00004E48 File Offset: 0x00003048
        private int nss_decrypt(string b64_encrypted_data, ref string buf)
        {
            int result = 0;

            MozillaSDR.SECItem secitem = default(MozillaSDR.SECItem);
            IntPtr             intPtr  = IntPtr.Zero;

            buf          = string.Empty;
            secitem.data = IntPtr.Zero;
            secitem.len  = 0;
            intPtr       = MozillaSDR.NSSBase64_DecodeBuffer(IntPtr.Zero, IntPtr.Zero, b64_encrypted_data, b64_encrypted_data.Length);
            if (intPtr == IntPtr.Zero)
            {
                result = -1;
            }
            else
            {
                int num = MozillaSDR.PK11SDR_Decrypt(intPtr, ref secitem, 0);
                if (num != 0)
                {
                    result = -2;
                }
                else
                {
                    buf = Marshal.PtrToStringAnsi(secitem.data, secitem.len);
                    MozillaSDR.SECITEM_FreeItem(ref secitem, 0);
                }
                MozillaSDR.SECITEM_FreeItem(intPtr, 1);
            }
            if (secitem.data != IntPtr.Zero)
            {
                Marshal.FreeHGlobal(secitem.data);
            }
            return(result);
        }
Example #2
0
        // Token: 0x0600014F RID: 335 RVA: 0x00004F08 File Offset: 0x00003108
        private int nss_decode(string b64_encrypted_data, ref string buf)
        {
            int result = 0;

            MozillaSDR.SECItem secitem = default(MozillaSDR.SECItem);
            IntPtr             intPtr  = IntPtr.Zero;

            buf    = string.Empty;
            intPtr = MozillaSDR.NSSBase64_DecodeBuffer(IntPtr.Zero, IntPtr.Zero, b64_encrypted_data, b64_encrypted_data.Length);
            if (intPtr == IntPtr.Zero)
            {
                result = -1;
            }
            else
            {
                secitem = (MozillaSDR.SECItem)Marshal.PtrToStructure(intPtr, typeof(MozillaSDR.SECItem));
                buf     = Marshal.PtrToStringAnsi(secitem.data, secitem.len);
                MozillaSDR.SECITEM_FreeItem(intPtr, 1);
            }
            return(result);
        }
Example #3
0
 private static extern int SECITEM_FreeItem(ref MozillaSDR.SECItem item, int bDestroy);
Example #4
0
 private static extern int PK11SDR_Decrypt(IntPtr encrypted_item, ref MozillaSDR.SECItem text, int p1);