Package ratpack.ssl
Class SSLContexts
- java.lang.Object
-
- ratpack.ssl.SSLContexts
-
public class SSLContexts extends java.lang.Object
Factory methods for initializing anSSLContext
.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static javax.net.ssl.SSLContext
sslContext(java.io.File keyStoreFile, java.lang.String password)
Creates an SSL context using a password-protected keystore file.static javax.net.ssl.SSLContext
sslContext(java.io.File keyStoreFile, java.lang.String keyStorePassword, java.io.File trustStoreFile, java.lang.String trustStorePassword)
Creates an SSL context using password protected keystore as well as password protected truststore file.static javax.net.ssl.SSLContext
sslContext(java.io.InputStream keyStoreStream, java.lang.String password)
Creates an SSL context using a password-protected keystore file.static javax.net.ssl.SSLContext
sslContext(java.io.InputStream keyStoreStream, java.lang.String keyStorePassword, java.io.InputStream trustStoreStream, java.lang.String trustStorePassword)
Creates an SSL context using password protected keystore as well as password protected truststore file.static javax.net.ssl.SSLContext
sslContext(java.net.URL keyStoreFile, java.lang.String password)
Creates an SSL context using a password-protected keystore file.static javax.net.ssl.SSLContext
sslContext(java.net.URL keyStoreFile, java.lang.String keyStorePassword, java.net.URL trustStoreFile, java.lang.String trustStorePassword)
Creates an SSL context using password protected keystore as well as password protected truststore file.static javax.net.ssl.SSLContext
sslContext(java.nio.file.Path keyStoreFile, java.lang.String password)
Creates an SSL context using a password-protected keystore file.static javax.net.ssl.SSLContext
sslContext(java.nio.file.Path keyStoreFile, java.lang.String keyStorePassword, java.nio.file.Path trustStoreFile, java.lang.String trustStorePassword)
Creates an SSL context using password protected keystore as well as password protected truststore file.
-
-
-
Method Detail
-
sslContext
public static javax.net.ssl.SSLContext sslContext(java.net.URL keyStoreFile, java.lang.String password) throws java.security.GeneralSecurityException, java.io.IOException
Creates an SSL context using a password-protected keystore file.- Parameters:
keyStoreFile
- afile://
URL referencing a keystore filepassword
- the password for the keystore file- Returns:
- A newly created ssl context
- Throws:
java.security.GeneralSecurityException
- if the keystore is invalid, or the password is incorrectjava.io.IOException
- if the url cannot be read
-
sslContext
public static javax.net.ssl.SSLContext sslContext(java.net.URL keyStoreFile, java.lang.String keyStorePassword, java.net.URL trustStoreFile, java.lang.String trustStorePassword) throws java.security.GeneralSecurityException, java.io.IOException
Creates an SSL context using password protected keystore as well as password protected truststore file.- Parameters:
keyStoreFile
- afile://
URL referencing a keystore filekeyStorePassword
- the password for the keystore filetrustStoreFile
- afile://
URL referencing a truststore filetrustStorePassword
- the password for the truststore file- Returns:
- A newly created ssl context
- Throws:
java.security.GeneralSecurityException
- if either the keystore or truststore is invalid, or the password is incorrectjava.io.IOException
- if any of the urls cannot be read
-
sslContext
public static javax.net.ssl.SSLContext sslContext(java.io.File keyStoreFile, java.lang.String password) throws java.security.GeneralSecurityException, java.io.IOException
Creates an SSL context using a password-protected keystore file.- Parameters:
keyStoreFile
- a keystore filepassword
- the password for the keystore file- Returns:
- A newly created ssl context
- Throws:
java.security.GeneralSecurityException
- if the keystore is invalid, or the password is incorrectjava.io.IOException
- if the url cannot be read
-
sslContext
public static javax.net.ssl.SSLContext sslContext(java.io.File keyStoreFile, java.lang.String keyStorePassword, java.io.File trustStoreFile, java.lang.String trustStorePassword) throws java.security.GeneralSecurityException, java.io.IOException
Creates an SSL context using password protected keystore as well as password protected truststore file.- Parameters:
keyStoreFile
- a keystore filekeyStorePassword
- the pasword for the keystore filetrustStoreFile
- a truststore filetrustStorePassword
- the password for the truststore file- Returns:
- A newly created ssl context
- Throws:
java.security.GeneralSecurityException
- if either the keystore or truststore is invalid, or the password is incorrectjava.io.IOException
- if any of the urls cannot be read
-
sslContext
public static javax.net.ssl.SSLContext sslContext(java.nio.file.Path keyStoreFile, java.lang.String password) throws java.security.GeneralSecurityException, java.io.IOException
Creates an SSL context using a password-protected keystore file.- Parameters:
keyStoreFile
- a keystore filepassword
- the password for the keystore file- Returns:
- A newly created ssl context
- Throws:
java.security.GeneralSecurityException
- if the keystore is invalid, or the password is incorrectjava.io.IOException
- if the url cannot be read
-
sslContext
public static javax.net.ssl.SSLContext sslContext(java.nio.file.Path keyStoreFile, java.lang.String keyStorePassword, java.nio.file.Path trustStoreFile, java.lang.String trustStorePassword) throws java.security.GeneralSecurityException, java.io.IOException
Creates an SSL context using password protected keystore as well as password protected truststore file.- Parameters:
keyStoreFile
- a keystore filekeyStorePassword
- the password for the keystore filetrustStoreFile
- a truststore filetrustStorePassword
- the password for the truststore file- Returns:
- A newly created ssl context
- Throws:
java.security.GeneralSecurityException
- if either the keystore or the truststore is invalid, or the password is incorrectjava.io.IOException
- if any of the urls cannot be read
-
sslContext
public static javax.net.ssl.SSLContext sslContext(java.io.InputStream keyStoreStream, java.lang.String password) throws java.security.GeneralSecurityException, java.io.IOException
Creates an SSL context using a password-protected keystore file.- Parameters:
keyStoreStream
- an input stream reading a keystore filepassword
- the password for the keystore file- Returns:
- A newly created ssl context
- Throws:
java.security.GeneralSecurityException
- if the keystore is invalid, or the password is incorrectjava.io.IOException
- if the url cannot be read
-
sslContext
public static javax.net.ssl.SSLContext sslContext(java.io.InputStream keyStoreStream, java.lang.String keyStorePassword, java.io.InputStream trustStoreStream, java.lang.String trustStorePassword) throws java.security.GeneralSecurityException, java.io.IOException
Creates an SSL context using password protected keystore as well as password protected truststore file.In SSL handshake the purpose of of keystore is to provide credentials, while the purpose of truststore is to verify credentials.
Trustore stores certificates from thrid parties that application trusts or certificates signed by CA that can be used to identify third party. Keystore stores private key and public key that are used to generate certificates exposed to clients or used in client SSL authentication.
- Parameters:
keyStoreStream
- an input stream reading keystore filekeyStorePassword
- the password for the keystore filetrustStoreStream
- an input stream reading truststore filetrustStorePassword
- the password for the truststore file- Returns:
- A newly created ssl context
- Throws:
java.security.GeneralSecurityException
- if either the keystore or the truststore is invalid, or the password is incorrectjava.io.IOException
- if any of the urls cannot be read
-
-