Exemple #1
0
        private bool ProcessServerCertificate(IntPtr Connection, IntPtr pServerCert)
        {
            bool flag = true;

            if (this.serverCertificateDelegate != null)
            {
                IntPtr          intPtr          = (IntPtr)0;
                X509Certificate x509Certificate = null;
                try
                {
                    intPtr          = Marshal.ReadIntPtr(pServerCert);
                    x509Certificate = new X509Certificate(intPtr);
                }
                finally
                {
                    Wldap32.CertFreeCRLContext(intPtr);
                }
                flag = this.serverCertificateDelegate(this.connection, x509Certificate);
            }
            return(flag);
        }
        private bool ProcessServerCertificate(IntPtr Connection, IntPtr pServerCert)
        {
            bool flag = true;

            if (this.serverCertificateDelegate == null)
            {
                return(flag);
            }
            IntPtr          zero        = IntPtr.Zero;
            X509Certificate certificate = null;

            try
            {
                zero        = Marshal.ReadIntPtr(pServerCert);
                certificate = new X509Certificate(zero);
            }
            finally
            {
                Wldap32.CertFreeCRLContext(zero);
            }
            return(this.serverCertificateDelegate(this.connection, certificate));
        }
Exemple #3
0
        private bool ProcessServerCertificate(IntPtr Connection, IntPtr pServerCert)
        {
            // if callback is not specified by user, it means server certificate is accepted
            bool value = true;

            if (_serverCertificateDelegate != null)
            {
                IntPtr          certPtr     = (IntPtr)0;
                X509Certificate certificate = null;
                try
                {
                    Debug.Assert(pServerCert != (IntPtr)0);
                    certPtr     = Marshal.ReadIntPtr(pServerCert);
                    certificate = new X509Certificate(certPtr);
                }
                finally
                {
                    Wldap32.CertFreeCRLContext(certPtr);
                }
                value = _serverCertificateDelegate(_connection, certificate);
            }
            return(value);
        }