Interface TlsService
-
public interface TlsServiceInterface for SSL/TLS services. Provides methods to retrieve SSL contexts and test connections using specific TLS scopes.- Since:
- 8.5.0
- Author:
- XIMA Media GmbH
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description @NotNull ITlsConnectionTestContextgetConnectionTestContext(TlsScope scope)Retrieves the TLS connection test context for the specified TLS scope.static TlsServicegetInstance()Retrieves the singleton instance of theTlsService.@NotNull SSLContextgetSSLContext(TlsScope scope)Retrieves the SSL context for the specified TLS scope.@NotNull X509TrustManagergetTrustManager(TlsScope scope)Retrieves the TrustManager for the specified TLS scope.@NotNull KeyStoregetTrustStore(TlsScope scope, String defaultType)Retrieves the KeyStore used as the trust store for the specified TLS scope.@NotNull ConnectionTestResulttestConnection(String host, int port, TlsScope tlsScope)Tests the connection to a specified host and port using the provided TLS scope.@NotNull ConnectionTestResulttestConnection(String host, int port, TlsScope tlsScope, int connectionTimeout)Tests the connection to a specified host and port using the provided TLS scope and connection timeout.
-
-
-
Method Detail
-
getInstance
static TlsService getInstance()
Retrieves the singleton instance of theTlsService. This method uses CDI to obtain the instance.- Returns:
- The singleton instance of the
TlsService.
-
getConnectionTestContext
@NotNull @NotNull ITlsConnectionTestContext getConnectionTestContext(TlsScope scope) throws FcCertificateProviderException
Retrieves the TLS connection test context for the specified TLS scope. The connection test context can be used to test connections based on anSSLContext. The result of the connection test can be accessed via theConnectionTestResultinterface.- Parameters:
scope- The TLS scope for which the connection test context is required.- Returns:
- The TLS connection test context corresponding to the given scope.
- Throws:
FcCertificateProviderException- If an error occurs while retrieving the connection test context.- See Also:
ConnectionTestResult,the SSL context that can be used to test connections,result of the last server trust validation
-
getSSLContext
@NotNull @NotNull SSLContext getSSLContext(TlsScope scope) throws FcCertificateProviderException
Retrieves the SSL context for the specified TLS scope.- Parameters:
scope- The TLS scope for which the SSL context is required.- Returns:
- The SSL context corresponding to the given scope.
- Throws:
FcCertificateProviderException- If an error occurs while retrieving the SSL context.
-
getTrustManager
@NotNull @NotNull X509TrustManager getTrustManager(TlsScope scope) throws FcCertificateProviderException
Retrieves the TrustManager for the specified TLS scope.- Parameters:
scope- The TLS scope for which the TrustManager is required.- Returns:
- The TrustManager corresponding to the given scope.
- Throws:
FcCertificateProviderException- If an error occurs while retrieving the TrustManager.
-
getTrustStore
@NotNull @NotNull KeyStore getTrustStore(TlsScope scope, String defaultType) throws FcCertificateProviderException
Retrieves the KeyStore used as the trust store for the specified TLS scope.- Parameters:
scope- The TLS scope for which the trust store is required.defaultType- The type of KeyStore to use (e.g., "JKS", "PKCS12").- Returns:
- The KeyStore used as the trust store corresponding to the given scope.
- Throws:
FcCertificateProviderException- If an error occurs while retrieving the trust store.
-
testConnection
@NotNull @NotNull ConnectionTestResult testConnection(String host, int port, TlsScope tlsScope) throws FcCertificateProviderException
Tests the connection to a specified host and port using the provided TLS scope.- Parameters:
host- The hostname to connect to.port- The port number to connect to.tlsScope- The TLS scope used to determine the SSL context for the connection test.- Returns:
- The result of the connection test.
- Throws:
FcCertificateProviderException
-
testConnection
@NotNull @NotNull ConnectionTestResult testConnection(String host, int port, TlsScope tlsScope, int connectionTimeout) throws FcCertificateProviderException
Tests the connection to a specified host and port using the provided TLS scope and connection timeout.- Parameters:
host- The hostname to connect to.port- The port number to connect to.connectionTimeout- The timeout for the connection attempt in milliseconds.tlsScope- The TLS scope used to determine the SSL context for the connection test.- Returns:
- The result of the connection test.
- Throws:
FcCertificateProviderException
-
-