I have in my hand an SSL LDAP server certificate. I want to use it to connect to the LDAP server using UnboundID SDK.
I do not want to use com.unboundid.util.ssl.TrustAllTrustManager as was showed here: Using UnboundID SDK with an SSL certificate file to connect to LDAP server in Android app
The following TrustManagers not fit our product requirements:
com.unboundid.util.ssl.PromptTrustManager
com.unboundid.util.ssl.HostNameTrustManager
com.unboundid.util.ssl.ValidityDateTrustManager
I do not want any user interaction, and what I miss in the list above the TrustManager that validate the certificate issuers.
Also, I do not want to insert the LDAP server certificate in any keystore, so I can not 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);
Please note, that CertificateTrustManager does not exist in UnboundID SDK. How is possible to do it?