public class TlsOptions extends Object
The client credentials comprise an encrypted private key with a client certificate. The trust material comprises one or more certificates.
The favoured way to create TlsOptions objects is using the methods TlsOptions#createFromBlobs and TlsOptions#createFromFiles; both accept the DER encoded client credentials in PKCS#12 format and the DER encoded trusted material in PKCS#7 format. While these methods are expected to cover the vast majority of use cases, the TlsOptions#create method is provided for maximum flexibility. TlsOptions#create allows direct specification of a SSLContext that will be used in establishing secure connections.
| Modifier and Type | Class and Description |
|---|---|
static class |
TlsOptions.TlsInitializationException |
| Modifier and Type | Method and Description |
|---|---|
static TlsOptions |
create(SSLContext sslContext)
Creates a
TlsOptions object with the specified
sslContext. |
static TlsOptions |
createFromBlobs(byte[] clientCredentialsRawData,
char[] clientCredentialsPassword,
byte[] trustedCertificatesRawData)
Creates
TlsOptions using client credentials and trust material
from the specified byte arrays. |
static TlsOptions |
createFromFiles(String clientCredentialsFileName,
char[] clientCredentialsPassword,
String trustedCertificatesFileName)
Creates
TlsOptions using client credentials and trust material
from the specified files. |
int |
getCrlTimeout()
Returns CRL timeout, which by default is 20 seconds.
|
SSLContext |
getSslContext()
Returns the
SSLContext object that will be used in
establishing secure connections. |
int |
getTlsHandshakeTimeout()
Returns TLS handshake timeout, which by default is 10 seconds.
|
void |
setCrlTimeout(int crlTimeout)
Sets CRL fetch timeout.
|
void |
setTlsHandshakeTimeout(int tlsHandshakeTimeout)
Sets TLS handshake timeout.
|
public static TlsOptions createFromFiles(String clientCredentialsFileName, char[] clientCredentialsPassword, String trustedCertificatesFileName) throws TlsOptions.TlsInitializationException
TlsOptions using client credentials and trust material
from the specified files.clientCredentialsFileName - DER encoded PKCS#12 file with client
credentialsclientCredentialsPassword - password for client credentials filetrustedCertificatesFileName - DER encoded PKCS#7 file with trusted
certificatesTlsOptions objectNullPointerException - if any argument is nullIllegalArgumentException - if either file exceeds 100 MB in sizeTlsOptions.TlsInitializationException - if there was a problem retrieving the
client credentials or trust materialpublic static TlsOptions createFromBlobs(byte[] clientCredentialsRawData, char[] clientCredentialsPassword, byte[] trustedCertificatesRawData) throws TlsOptions.TlsInitializationException
TlsOptions using client credentials and trust material
from the specified byte arrays.clientCredentialsRawData - byte array containing DER encoded
PKCS#12 store with client credentialsclientCredentialsPassword - password for the client credentialstrustedCertificatesRawData - byte array containing DER encoded
PKCS#7 store with trusted certificatesTlsOptions objectNullPointerException - if any argument is nullTlsOptions.TlsInitializationException - if there was a problem retrieving the
client credentials or trust materialpublic static TlsOptions create(SSLContext sslContext)
TlsOptions object with the specified
sslContext.sslContext - a context configured with DER encoded client credentials and
DER encoded trusted materialTlsOptions objectNullPointerException - if argument is nullpublic SSLContext getSslContext()
SSLContext object that will be used in
establishing secure connections.SSLContextpublic int getTlsHandshakeTimeout()
public void setTlsHandshakeTimeout(int tlsHandshakeTimeout)
tlsHandshakeTimeout - new timeout duration, a strictly positive
number of millisecondsIllegalArgumentException - if the new timeout is not strictly
positivepublic int getCrlTimeout()
public void setCrlTimeout(int crlTimeout)
crlTimeout - new timeout duration, a strictly positive number
of millisecondsIllegalArgumentException - if the new timeout is not strictly
positiveCopyright © 2021 Bloomberg L.P.. All rights reserved.