Interface SSLContextFactoryService
- All Known Implementing Classes:
DefaultSSLContextFactoryService
public interface SSLContextFactoryService
Interface which can be used to create the SSL context
-
Method Summary
Modifier and TypeMethodDescriptioncreateKeyManagerFactory(byte[] certBytes, byte[] keyBytes) Creates the array of key managers.Creates aSecureRandomcreateSSLContext(byte[] certBytes, byte[] keyBytes) Creates the ssl contextCreates the array of Trust managers.
-
Method Details
-
createSSLContext
SSLContext createSSLContext(byte[] certBytes, byte[] keyBytes) throws SSLContextFactoryCreationException Creates the ssl context- Parameters:
certBytes- byte array of the client certificate datakeyBytes- byte array of the private key- Returns:
- SSL context which is initialized with key managers and Trust managers
- Throws:
SSLContextFactoryCreationException- thrown when there is a problem in forming Key managers, Trust mangers or SSL context
-
createKeyManagerFactory
KeyManager[] createKeyManagerFactory(byte[] certBytes, byte[] keyBytes) throws SSLContextFactoryCreationException Creates the array of key managers. Used keystore type is "JKS" and key manager factory algorithm is "SunX509"- Parameters:
certBytes- byte array of the client certificate datakeyBytes- byte array of the private key- Returns:
- the array of KeyManagers
- Throws:
SSLContextFactoryCreationException- thrown when there is a problem in forming Key managers
-
createTrustManagerFactory
Creates the array of Trust managers. In order to check the revocation status of the certificate, either java.home or customised path to the cacerts must be set. In case both of them are present then the customised path is considered. If neither is set then the certificate revocation check is not performed.- Returns:
- array of TrustManagers, returns an empty array in case either java.home or customised path to the truststore cacerts is not configured.
- Throws:
SSLContextFactoryCreationException- thrown when there is a problem in forming trust managers
-
createSecureRandom
SecureRandom createSecureRandom()Creates aSecureRandom- Returns:
- newly created
SecureRandom
-