void getCtlinfo() { var CTLContext = (Wincrypt.CTL_CONTEXT)Marshal.PtrToStructure(Handle.DangerousGetHandle(), typeof(Wincrypt.CTL_CONTEXT)); CTLInfo = (Wincrypt.CTL_INFO)Marshal.PtrToStructure(CTLContext.pCtlInfo, typeof(Wincrypt.CTL_INFO)); Version = (Int32)CTLInfo.dwVersion + 1; }
internal static extern Boolean CryptMsgEncodeAndSignCTL( [In] UInt32 dwMsgEncodingType, [In] Wincrypt.CTL_INFO pCtlInfo, [In] Wincrypt.CMSG_SIGNED_ENCODE_INFO pSignInfo, [In] UInt32 dwFlags, [Out] Byte[] pbEncoded, [In, Out] ref UInt32 pcbEncoded );
void set_certs(X509Certificate2Collection certs) { List <Wincrypt.CTL_ENTRY> entries = (from X509Certificate2 cert in certs where !cert.Handle.Equals(IntPtr.Zero) select create_ctlentry(cert.Handle, cert.Thumbprint)).ToList(); CTLInfo = new Wincrypt.CTL_INFO { cCTLEntry = (UInt32)certs.Count, rgCTLEntry = create_ctlentries(entries) }; }
void get_ctlinfo() { Wincrypt.CTL_CONTEXT CTLContext = (Wincrypt.CTL_CONTEXT)Marshal.PtrToStructure(Handle, typeof(Wincrypt.CTL_CONTEXT)); CTLInfo = (Wincrypt.CTL_INFO)Marshal.PtrToStructure(CTLContext.pCtlInfo, typeof(Wincrypt.CTL_INFO)); Version = (Int32)CTLInfo.dwVersion + 1; }