Class SSLContextImpl
java.lang.Object
br.net.dd.netherwingcore.common.cryptography.SSLContextImpl
The SSLContextImpl class is a singleton implementation responsible for
initializing and providing an instance of
SSLContext. This class
performs critical operations such as loading cryptographic data (e.g., keystore
and certificates) and creating SSL/TLS contexts for secure connections.
This implementation ensures the correct loading of PKCS12 keystores and manages KeyManager and TrustManager initialization, providing a secure SSL context for use in applications.
The class throws runtime exceptions for missing resources, invalid configurations, or problems during initialization, ensuring all required settings and files are properly loaded.
Usage Example:
SSLContext sslContext = SSLContextImpl.get();
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic SSLContextget()Provides the singleton instance of the SSLContext.static InputStreamRetrieves a resource file (certificate or private key) as anInputStream.
-
Field Details
-
CERTIFICATE_CRT
- See Also:
-
CERTIFICATE_KEY
- See Also:
-
-
Method Details
-
get
Provides the singleton instance of the SSLContext.- Returns:
- The initialized
SSLContext.
-
get
Retrieves a resource file (certificate or private key) as anInputStream.- Parameters:
file- The file path to load, should be eitherCERTIFICATE_CRTorCERTIFICATE_KEY.- Returns:
- An
InputStreamof the requested file. - Throws:
RuntimeException- If the specified file is not found.
-