private static void DisplayX509Certificate(System.Security.Cryptography.SafeCertContextHandle safeCertContext, IntPtr hwndParent) { System.Security.Cryptography.CAPI.CRYPTUI_VIEWCERTIFICATE_STRUCTW cryptui_viewcertificate_structw; if (safeCertContext.IsInvalid) { throw new CryptographicException(SecurityResources.GetResourceString("Cryptography_InvalidHandle"), "safeCertContext"); } int num = 0; cryptui_viewcertificate_structw = new System.Security.Cryptography.CAPI.CRYPTUI_VIEWCERTIFICATE_STRUCTW { dwSize = Marshal.SizeOf(cryptui_viewcertificate_structw), hwndParent = hwndParent, dwFlags = 0, szTitle = null, pCertContext = safeCertContext.DangerousGetHandle(), rgszPurposes = IntPtr.Zero, cPurposes = 0, pCryptProviderData = IntPtr.Zero, fpCryptProviderDataTrustedUsage = false, idxSigner = 0, idxCert = 0, fCounterSigner = false, idxCounterSigner = 0, cStores = 0, rghStores = IntPtr.Zero, cPropSheetPages = 0, rgPropSheetPages = IntPtr.Zero, nStartPage = 0 }; if (!System.Security.Cryptography.CAPI.CryptUIDlgViewCertificateW(cryptui_viewcertificate_structw, IntPtr.Zero)) { num = Marshal.GetLastWin32Error(); } if ((num != 0) && (num != 0x4c7)) { throw new CryptographicException(Marshal.GetLastWin32Error()); } }
private static void DisplayX509Certificate(System.Security.Cryptography.SafeCertContextHandle safeCertContext, IntPtr hwndParent) { System.Security.Cryptography.CAPI.CRYPTUI_VIEWCERTIFICATE_STRUCTW cryptui_viewcertificate_structw; if (safeCertContext.IsInvalid) { throw new CryptographicException(SecurityResources.GetResourceString("Cryptography_InvalidHandle"), "safeCertContext"); } int num = 0; cryptui_viewcertificate_structw = new System.Security.Cryptography.CAPI.CRYPTUI_VIEWCERTIFICATE_STRUCTW { dwSize = Marshal.SizeOf(cryptui_viewcertificate_structw), hwndParent = hwndParent, dwFlags = 0, szTitle = null, pCertContext = safeCertContext.DangerousGetHandle(), rgszPurposes = IntPtr.Zero, cPurposes = 0, pCryptProviderData = IntPtr.Zero, fpCryptProviderDataTrustedUsage = false, idxSigner = 0, idxCert = 0, fCounterSigner = false, idxCounterSigner = 0, cStores = 0, rghStores = IntPtr.Zero, cPropSheetPages = 0, rgPropSheetPages = IntPtr.Zero, nStartPage = 0 }; if (!System.Security.Cryptography.CAPI.CryptUIDlgViewCertificateW(cryptui_viewcertificate_structw, IntPtr.Zero)) { num = Marshal.GetLastWin32Error(); } if ((num != 0) && (num != 0x4c7)) { throw new CryptographicException(Marshal.GetLastWin32Error()); } }