Interface SSLContextFactoryService
-
- All Known Implementing Classes:
DefaultSSLContextFactoryService
public interface SSLContextFactoryService
Interface which can be used to create the SSL context
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description javax.net.ssl.KeyManager[]
createKeyManagerFactory(byte[] certBytes, byte[] keyBytes)
Creates the array of key managers.java.security.SecureRandom
createSecureRandom()
Creates aSecureRandom
javax.net.ssl.SSLContext
createSSLContext(byte[] certBytes, byte[] keyBytes)
Creates the ssl contextjavax.net.ssl.TrustManager[]
createTrustManagerFactory()
Creates the array of Trust managers.
-
-
-
Method Detail
-
createSSLContext
javax.net.ssl.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
javax.net.ssl.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
javax.net.ssl.TrustManager[] createTrustManagerFactory() throws SSLContextFactoryCreationException
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
java.security.SecureRandom createSecureRandom()
Creates aSecureRandom
- Returns:
- newly created
SecureRandom
-
-