Ejemplo n.º 1
0
        void m_initialize(Byte[] message)
        {
            RawData = message;
            ContentInfo2 info = new ContentInfo2(RawData);

            getSequence(info);
        }
Ejemplo n.º 2
0
        void switchInnerType(Wincrypt.CRYPTOAPI_BLOB blob)
        {
            ContentInfo2 info = new ContentInfo2(blob);

            ContentType = info.ContentType;
            switch (info.ContentType.Value)
            {
            case "1.3.6.1.5.5.7.12.2":
                decodeCMC(info.RawData);
                break;

            default:
                Content = info.RawData;
                break;
            }
        }
Ejemplo n.º 3
0
        void getSequence(ContentInfo2 info)
        {
            UInt32 pcbStructInfo = 0;

            if (!Crypt32.CryptDecodeObject(1, Wincrypt.X509_SEQUENCE_OF_ANY, info.RawData, (UInt32)info.RawData.Length, 0, IntPtr.Zero, ref pcbStructInfo))
            {
                throw new Win32Exception(Marshal.GetLastWin32Error());
            }
            IntPtr pvStructInfo = Marshal.AllocHGlobal((Int32)pcbStructInfo);

            try {
                Crypt32.CryptDecodeObject(1, Wincrypt.X509_SEQUENCE_OF_ANY, info.RawData, (UInt32)info.RawData.Length, 0, pvStructInfo, ref pcbStructInfo);
                Wincrypt.CRYPTOAPI_BLOB sequence = (Wincrypt.CRYPTOAPI_BLOB)Marshal.PtrToStructure(pvStructInfo, typeof(Wincrypt.CRYPTOAPI_BLOB));
                if (sequence.cbData == 0)
                {
                    return;
                }
                UnrollPkcs7(sequence);
            } finally {
                Marshal.FreeHGlobal(pvStructInfo);
            }
        }