Class CustomX509TrustManager

java.lang.Object
com.castlabs.android.network.CustomX509TrustManager
All Implemented Interfaces:
TrustManager, X509TrustManager

public final class CustomX509TrustManager extends Object implements X509TrustManager
Custom implementation of X509TrustManager uses two key stores: system default one and provided custom key store. When validating the certificates, first the system default key store is used and in case the certificate can not be verified then the custom key store is then contacted.

The current trust manager can be used when your certificate is not (yet) trusted by the system or the application is running on the older version of system without the needed CA.

Note: The application shall take care of maintaining the custom key store and keeping it up-to-date.

Note: There is a limitation using the custom TrustManagers with X509TrustManagerExtensions, which does not allow custom implementations of the TrustManager interface, see the older (marshmallow and older) implementation of X509TrustManagerExtensions(509TrustManager tm) constructor, throwing the IllegalArgumentException. In its turn, it effects all the code which uses this constructor e.g. http3 AndroidPlatform.buildCertificateChainCleaner(X509TrustManager trustManager) throwing exception and bringing extra significant delay when opening a connection.

Since:
4.2.0