Class SslContextUtil
java.lang.Object
com.thanlinardos.spring_enterprise_library.https.utils.SslContextUtil
Utility class for building SSL contexts and REST clients with custom keystore and truststore configurations.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic jakarta.ws.rs.client.ClientbuildResteasyClient(KeyAndTrustStoreProperties keystore, KeyAndTrustStoreProperties truststore) Builds a RESTEasy client with the specified keystore and truststore properties.static SSLContextbuildSSLContext(KeyAndTrustStoreProperties keystore, KeyAndTrustStoreProperties truststore) Builds an SSL context with the specified keystore and truststore properties.
-
Constructor Details
-
SslContextUtil
public SslContextUtil()
-
-
Method Details
-
buildResteasyClient
public static jakarta.ws.rs.client.Client buildResteasyClient(KeyAndTrustStoreProperties keystore, KeyAndTrustStoreProperties truststore) throws UnrecoverableKeyException, CertificateException, KeyStoreException, IOException, NoSuchAlgorithmException, KeyManagementException Builds a RESTEasy client with the specified keystore and truststore properties.- Parameters:
keystore- the keystore propertiestruststore- the truststore properties- Returns:
- a configured RESTEasy client
- Throws:
UnrecoverableKeyException- if the key cannot be recovered from the keystoreCertificateException- if there is an error with the certificatesKeyStoreException- if there is an error with the keystoreIOException- if there is an I/O errorNoSuchAlgorithmException- if the algorithm for key management is not availableKeyManagementException- if there is an error managing keys
-
buildSSLContext
public static SSLContext buildSSLContext(KeyAndTrustStoreProperties keystore, KeyAndTrustStoreProperties truststore) throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException, KeyManagementException, UnrecoverableKeyException Builds an SSL context with the specified keystore and truststore properties.- Parameters:
keystore- the keystore propertiestruststore- the truststore properties- Returns:
- a configured SSL context
- Throws:
KeyStoreException- if there is an error with the keystoreIOException- if there is an I/O errorNoSuchAlgorithmException- if the algorithm for key management is not availableCertificateException- if there is an error with the certificatesKeyManagementException- if there is an error managing keysUnrecoverableKeyException- if the key cannot be recovered from the keystore
-