wstrange/dartdap

Help SSL true not Working

Closed this issue · 2 comments

I/flutter ( 7562): 2022-07-01 15:07:15.756105: ldap.connection: FINE: open: ldaps://10...7:636
I/flutter ( 7562): 2022-07-01 15:07:15.999901: ldap.connection: SEVERE: Exception on connect
I/flutter ( 7562): ********* Exception: Bad X.509 certificate: subject=; issuer=/DC=ng/DC=com/DC=example/CN=Example-ENT01 #0 LdapConnection.defaultBadCertHandler (package:dartdap/src/dartdap/client/ldap_connection.dart:403:5)
I/flutter ( 7562): #1 _RawSecureSocket._onBadCertificateWrapper (dart:io/secure_socket.dart:825:29)
I/flutter ( 7562): #2 _SecureFilterImpl._handshake (dart:io-patch/secure_socket_patch.dart:99:46)
I/flutter ( 7562): #3 _SecureFilterImpl.handshake (dart:io-patch/secure_socket_patch.dart:142:25)
I/flutter ( 7562): #4 _RawSecureSocket._secureHandshake (dart:io/secure_socket.dart:911:54)
I/flutter ( 7562): #5 _RawSecureSocket._tryFilter (dart:io/secure_socket.dart:1040:19)
I/flutter ( 7562):
I/flutter ( 7562): Closing
I/flutter ( 7562): 2022-07-01 15:07:16.004169: ldap.connection: FINE: close

I need support, if possible example of script to use - am new to flutter and ad ldaps

The certificate being presented is not valid, or you don't have the the right cert chain in your keystore to verify the cert.

The easiest fix for this (assuming you trust the server) is to ignore the cert error. Not a good long term solution but it will get you going.

You ignore the cert error by supply a bad cert handler in the connection:

Something like:

LdapConnection(host: 'my-host', ....      badCertificateHandler: (cert) => print('ignore bad cert') );

Thank you @wstrange

I used below code as the function is a bool and it was able to bind and search FINE:
LdapConnection(host: 'my-host', .... badCertificateHandler: (cert)=> true );