Package com.unboundid.util.ssl
Class PEMFileTrustManager
java.lang.Object
com.unboundid.util.ssl.PEMFileTrustManager
- All Implemented Interfaces:
Serializable,TrustManager,X509TrustManager
@NotMutable
@ThreadSafety(level=COMPLETELY_THREADSAFE)
public final class PEMFileTrustManager
extends Object
implements X509TrustManager, Serializable
This class provides an implementation of an X.509 trust manager that can
obtain information about trusted issuers from one or more PEM files.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionPEMFileTrustManager(File... pemFiles) Creates a new PEM file trust manager that will read trusted certificate information from the specified PEM files.PEMFileTrustManager(List<File> pemFiles) Creates a new PEM file trust manager that will read trusted certificate information from the specified PEM files. -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckClientTrusted(X509Certificate[] chain, String authType) Determines whether the provided client certificate chain should be considered trusted based on the trusted certificate information read from PEM files.voidcheckServerTrusted(X509Certificate[] chain, String authType) Determines whether the provided server certificate chain should be considered trusted based on the trusted certificate information read from PEM files.Retrieves an array of the issuer certificates that will be considered trusted.
-
Constructor Details
-
PEMFileTrustManager
Creates a new PEM file trust manager that will read trusted certificate information from the specified PEM files.- Parameters:
pemFiles- The PEM files from which to read the trusted certificate information. It must not benullor empty, and all files must exist. Each element may be a file (which may contain one or more PEM-formatted certificates) or a directory (in which case all of the files in that directory, including subdirectories will be recursively processed).- Throws:
KeyStoreException- If a problem occurs while trying to read or decode any of the certificates.
-
PEMFileTrustManager
Creates a new PEM file trust manager that will read trusted certificate information from the specified PEM files.- Parameters:
pemFiles- The PEM files from which to read the trusted certificate information. It must not benullor empty, and all files must exist. Each element may be a file (which may contain one or more PEM-formatted certificates) or a directory (in which case all of the files in that directory, including subdirectories will be recursively processed).- Throws:
KeyStoreException- If a problem occurs while trying to read or decode any of the certificates.
-
-
Method Details
-
checkClientTrusted
public void checkClientTrusted(@NotNull X509Certificate[] chain, @NotNull String authType) throws CertificateException Determines whether the provided client certificate chain should be considered trusted based on the trusted certificate information read from PEM files.- Specified by:
checkClientTrustedin interfaceX509TrustManager- Parameters:
chain- The client certificate chain for which to make the determination. It must not benullor empty.authType- The type of authentication to use based on the client certificate. It must not benull.- Throws:
CertificateException- If the provided certificate chain should not be considered trusted.
-
checkServerTrusted
public void checkServerTrusted(@NotNull X509Certificate[] chain, @NotNull String authType) throws CertificateException Determines whether the provided server certificate chain should be considered trusted based on the trusted certificate information read from PEM files.- Specified by:
checkServerTrustedin interfaceX509TrustManager- Parameters:
chain- The server certificate chain for which to make the determination. It must not benullor empty.authType- The type of authentication to use based on the server certificate. It must not benull.- Throws:
CertificateException- If the provided certificate chain should not be considered trusted.
-
getAcceptedIssuers
Retrieves an array of the issuer certificates that will be considered trusted.- Specified by:
getAcceptedIssuersin interfaceX509TrustManager- Returns:
- An array of the issuer certificates that will be considered trusted, or an empty array if no issuers will be trusted.
-