I have at my disposal an SSL LDAP certificate. I want to use it to connect to an LDAP server using the UnboundID SDK.
I do not want to use com.unboundid.util.ssl.TrustAllTrustManager, as shown here: Using the UnboundID SDK with an SSL certificate file to connect to an LDAP server in an Android application
The following TrustManager do not meet our product requirements:
com.unboundid.util.ssl.PromptTrustManager com.unboundid.util.ssl.HostNameTrustManager com.unboundid.util.ssl.ValidityDateTrustManager
I do not want any interaction with the user, and that I missed in the list above TrustManager, which checks the issuance of certificates.
In addition, I do not want to embed the LDAP server certificate in any keystore, so I cannot use the following TrustManagers:
com.unboundid.util.ssl.WrapperKeyManager com.unboundid.util.ssl.PKCS11KeyManager com.unboundid.util.ssl.KeyStoreKeyManager
I want to do something like the code below:
CertificateFactory cf = CertificateFactory.getInstance("X.509"); Certificate cert = cf.generateCertificate(byteArrayInputStream); SSLUtil sslUtil = new SSLUtil(new CertificateTrustManager(cert)); SSLSocketFactory socketFactory = sslUtil.createSSLSocketFactory(); LDAPConnection connection = new LDAPConnection(socketFactory, "server.example.com", 636);
Note that CertificateTrustManager does not exist in the UnboundID SDK. How can I do that?
source share