Package com.unboundid.util.ssl
Class TrustStoreTrustManager
java.lang.Object
com.unboundid.util.ssl.TrustStoreTrustManager
- All Implemented Interfaces:
Serializable,TrustManager,X509TrustManager
@NotMutable
@ThreadSafety(level=COMPLETELY_THREADSAFE)
public final class TrustStoreTrustManager
extends Object
implements X509TrustManager, Serializable
This class provides an SSL trust manager that will consult a specified trust
store file to determine whether to trust a certificate that is presented to
it. By default, it will use the default trust store format for the JVM
(e.g., "JKS" for Sun-provided Java implementations), but alternate formats
like PKCS12 may be used.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance of this trust store trust manager that will trust all certificates in the specified file with the specified constraints.TrustStoreTrustManager(File trustStoreFile) Creates a new instance of this trust store trust manager that will trust all certificates in the specified file within the validity window.TrustStoreTrustManager(File trustStoreFile, char[] trustStorePIN, String trustStoreFormat, boolean examineValidityDates) Creates a new instance of this trust store trust manager that will trust all certificates in the specified file with the specified constraints.TrustStoreTrustManager(String trustStoreFile) Creates a new instance of this trust store trust manager that will trust all certificates in the specified file within the validity window.TrustStoreTrustManager(String trustStoreFile, char[] trustStorePIN, String trustStoreFormat, boolean examineValidityDates) Creates a new instance of this trust store trust manager that will trust all certificates in the specified file with the specified constraints. -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckClientTrusted(X509Certificate[] chain, String authType) Checks to determine whether the provided client certificate chain should be trusted.voidcheckServerTrusted(X509Certificate[] chain, String authType) Checks to determine whether the provided server certificate chain should be trusted.booleanIndicate whether to reject certificates if the current time is outside the validity window for the certificate.Retrieves the accepted issuer certificates for this trust manager.Retrieves the path to the trust store file to use.Retrieves the name of the trust store file format.
-
Constructor Details
-
TrustStoreTrustManager
Creates a new instance of this trust store trust manager that will trust all certificates in the specified file within the validity window. It will use the default trust store format and will not provide a PIN when attempting to read the trust store.- Parameters:
trustStoreFile- The path to the trust store file to use. It must not benull.
-
TrustStoreTrustManager
Creates a new instance of this trust store trust manager that will trust all certificates in the specified file within the validity window. It will use the default trust store format and will not provide a PIN when attempting to read the trust store.- Parameters:
trustStoreFile- The path to the trust store file to use. It must not benull.
-
TrustStoreTrustManager
public TrustStoreTrustManager(@NotNull File trustStoreFile, @Nullable char[] trustStorePIN, @Nullable String trustStoreFormat, boolean examineValidityDates) Creates a new instance of this trust store trust manager that will trust all certificates in the specified file with the specified constraints.- Parameters:
trustStoreFile- The path to the trust store file to use. It must not benull.trustStorePIN- The PIN to use to access the contents of the trust store. It may benullif no PIN is required.trustStoreFormat- The format to use for the trust store. It may benullif the default format should be used.examineValidityDates- Indicates whether to reject certificates if the current time is outside the validity window for the certificate.
-
TrustStoreTrustManager
public TrustStoreTrustManager(@NotNull String trustStoreFile, @Nullable char[] trustStorePIN, @Nullable String trustStoreFormat, boolean examineValidityDates) Creates a new instance of this trust store trust manager that will trust all certificates in the specified file with the specified constraints.- Parameters:
trustStoreFile- The path to the trust store file to use. It must not benull.trustStorePIN- The PIN to use to access the contents of the trust store. It may benullif no PIN is required.trustStoreFormat- The format to use for the trust store. It may benullif the default format should be used.examineValidityDates- Indicates whether to reject certificates if the current time is outside the validity window for the certificate.
-
TrustStoreTrustManager
Creates a new instance of this trust store trust manager that will trust all certificates in the specified file with the specified constraints.- Parameters:
properties- The properties to use for this trust manager. It must not benull.
-
-
Method Details
-
getTrustStoreFile
Retrieves the path to the trust store file to use.- Returns:
- The path to the trust store file to use.
-
getTrustStoreFormat
Retrieves the name of the trust store file format.- Returns:
- The name of the trust store file format.
-
examineValidityDates
Indicate whether to reject certificates if the current time is outside the validity window for the certificate.- Returns:
trueif the certificate validity time should be examined and certificates should be rejected if they are expired or not yet valid, orfalseif certificates should be accepted even outside of the validity window.
-
checkClientTrusted
public void checkClientTrusted(@NotNull X509Certificate[] chain, @NotNull String authType) throws CertificateException Checks to determine whether the provided client certificate chain should be trusted.- Specified by:
checkClientTrustedin interfaceX509TrustManager- Parameters:
chain- The client certificate chain for which to make the determination.authType- The authentication type based on the client certificate.- Throws:
CertificateException- If the provided client certificate chain should not be trusted.
-
checkServerTrusted
public void checkServerTrusted(@NotNull X509Certificate[] chain, @NotNull String authType) throws CertificateException Checks to determine whether the provided server certificate chain should be trusted.- Specified by:
checkServerTrustedin interfaceX509TrustManager- Parameters:
chain- The server certificate chain for which to make the determination.authType- The key exchange algorithm used.- Throws:
CertificateException- If the provided server certificate chain should not be trusted.
-
getAcceptedIssuers
Retrieves the accepted issuer certificates for this trust manager. This will always return an empty array.- Specified by:
getAcceptedIssuersin interfaceX509TrustManager- Returns:
- The accepted issuer certificates for this trust manager.
-