Package com.sap.cloud.security.mtls
Class SSLContextFactory
- java.lang.Object
-
- com.sap.cloud.security.mtls.SSLContextFactory
-
public class SSLContextFactory extends Object
Creates a SSLContext (without Bouncy Castle crypto lib).
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SSLContextcreate(ClientIdentity clientIdentity)Creates a SSLContext which can be used to parameterize your Rest client, in order to support mutual TLS.SSLContextcreate(String x509Certificates, String rsaPrivateKey)Creates a SSLContext which can be used to parameterize your Rest client, in order to support mutual TLS.KeyStorecreateKeyStore(ClientIdentity clientIdentity)Initializes a KeyStore which can be used to parameterize your Rest client, in order to support mutual TLS.static SSLContextFactorygetInstance()
-
-
-
Method Detail
-
getInstance
public static SSLContextFactory getInstance()
-
create
public SSLContext create(String x509Certificates, String rsaPrivateKey) throws GeneralSecurityException, IOException
Creates a SSLContext which can be used to parameterize your Rest client, in order to support mutual TLS.- Parameters:
x509Certificates- you can get from your Service ConfigurationOAuth2ServiceConfiguration.getClientIdentity()rsaPrivateKey- you can get from your Service ConfigurationOAuth2ServiceConfiguration.getClientIdentity()- Returns:
- a new SSLContext instance
- Throws:
GeneralSecurityException- in case of key parsing errorsIOException- in case of KeyStore initialization errors
-
create
public SSLContext create(ClientIdentity clientIdentity) throws GeneralSecurityException, IOException
Creates a SSLContext which can be used to parameterize your Rest client, in order to support mutual TLS.- Parameters:
clientIdentity- you can get from your Service ConfigurationOAuth2ServiceConfiguration.getClientIdentity()- Returns:
- a new SSLContext instance
- Throws:
GeneralSecurityException- in case of key parsing errorsIOException- in case of KeyStore initialization errors
-
createKeyStore
public KeyStore createKeyStore(ClientIdentity clientIdentity) throws GeneralSecurityException, IOException
Initializes a KeyStore which can be used to parameterize your Rest client, in order to support mutual TLS.- Parameters:
clientIdentity- you can get from your Service ConfigurationOAuth2ServiceConfiguration.getClientIdentity()- Returns:
- a new KeyStore instance
- Throws:
GeneralSecurityException- in case of key parsing errorsIOException- in case of KeyStore initialization errors
-
-