Internal.Cryptography.Pal.ChainPal.FromHandle C# (CSharp) Method

FromHandle() public static method

public static FromHandle ( IntPtr chainContext ) : IChainPal
chainContext System.IntPtr
return IChainPal
        public static IChainPal FromHandle(IntPtr chainContext)
        {
            if (chainContext == IntPtr.Zero)
                throw new ArgumentNullException(nameof(chainContext));

            SafeX509ChainHandle certChainHandle = Interop.crypt32.CertDuplicateCertificateChain(chainContext);
            if (certChainHandle == null || certChainHandle.IsInvalid)
                throw new CryptographicException(SR.Cryptography_InvalidContextHandle, nameof(chainContext));

            var pal = new ChainPal(certChainHandle);
            return pal;
        }