System.directoryServicesのLDAPを使用してstartTLSを使用します
-
29-10-2019 - |
質問
starttlsを必要とするLDAPサーバーに接続しようとしていますが、運がありません。Sessionoptions.starttransportlayersecurity(..)またはSets sessionoptions.secureSocketlayerを使用するたびに、TrueにsecureSocketlayerを設定します。例外を取得します。
これが私が使用しているコードです:
using (var connection = new LdapConnection(new LdapDirectoryIdentifier(config.LdapServer, config.Port, false, false)))
{
connection.SessionOptions.ProtocolVersion = 3;
connection.Credential = new NetworkCredential(config.BindDN, config.BindPassword);
connection.SessionOptions.VerifyServerCertificate += (conn, cert) => {return true;};
connection.AuthType = AuthType.Basic;
//connection.SessionOptions.SecureSocketLayer = true;
connection.SessionOptions.StartTransportLayerSecurity(null); // throws here, same if done after bind.
connection.Bind();
... do stuff with connection
}
結果の例外は、「tlsoperationexception:不特定のエラーが発生した」です。これは、StartTransportlayerseCurityメソッドを呼び出すときに発生します。
両方に対してコードをテストし、OpenLdapサーバーとActive Directoryをテストしましたが、どちらも機能しません。
StastTLSをsystem.directoryServicesで動作させる方法を知っている人はいますか?
正しい解決策はありません
所属していません StackOverflow