System.DirectoryServices and SSL Certificate Policies
-
Hi all, I am interested in the way SSL Certificates are validated when using SecureSocketsLayer authentication to access a directory service over LDAP. Without going too much into it, this is what works:
DirectoryEntry searchRoot = new DirectoryEntry(location, username, password, AuthenticationTypes.SecureSocketsLayer); object nativeObject = m_searchRoot.NativeObject; searchRoot.RefreshCache();
Of course, it only works when correct certificates are installed on the machine attempting to execute this code. If the certificates are not installed, then the SSL connection supporting the DirectoryEntry fails with a COMException, claiming the server is not operational. I would like to find where exactly the certificate is being checked, so I can override the validation behaviour. I need something similar to what is described here, but applies to a DirectoryEntry. The approach specified in the link doesn't solve my problem -- it doesn't seem like the System.Net.ServicePointManager.CertificatePolicy is used at all in my code. Does anyone have any ideas? Thanks in advance. Cheers, Misha