System.Net.CertificateValidationPal.Verify C# (CSharp) Method

Verify() private static method

private static Verify ( SafeX509ChainHandle chainContext, System.Net.Interop &cpp ) : uint
chainContext Microsoft.Win32.SafeHandles.SafeX509ChainHandle
cpp System.Net.Interop
return uint
        private static uint Verify(SafeX509ChainHandle chainContext, ref Interop.Crypt32.CERT_CHAIN_POLICY_PARA cpp)
        {
            if (NetEventSource.IsEnabled) NetEventSource.Enter(chainContext, cpp.dwFlags);

            var status = new Interop.Crypt32.CERT_CHAIN_POLICY_STATUS();
            status.cbSize = (uint)Marshal.SizeOf<Interop.Crypt32.CERT_CHAIN_POLICY_STATUS>();

            bool errorCode =
                Interop.Crypt32.CertVerifyCertificateChainPolicy(
                    (IntPtr)Interop.Crypt32.CertChainPolicy.CERT_CHAIN_POLICY_SSL,
                    chainContext,
                    ref cpp,
                    ref status);

            if (NetEventSource.IsEnabled) NetEventSource.Info(chainContext, $"CertVerifyCertificateChainPolicy returned: {errorCode}. Status: {status.dwError}");
            return status.dwError;
        }
    }