Package com.bloomberglp.blpapi
Class TlsOptions
java.lang.Object
com.bloomberglp.blpapi.TlsOptions
TlsOptions instances are sources of client credentials and trust material used by a session to
establish secure mutually authenticated connections to endpoints.
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.
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic TlsOptions
create
(SSLContext sslContext) Creates aTlsOptions
object with the specifiedsslContext
.static TlsOptions
createFromBlobs
(byte[] clientCredentialsRawData, char[] clientCredentialsPassword, byte[] trustedCertificatesRawData) CreatesTlsOptions
using client credentials and trust material from the specified byte arrays.static TlsOptions
createFromFiles
(String clientCredentialsFileName, char[] clientCredentialsPassword, String trustedCertificatesFileName) CreatesTlsOptions
using client credentials and trust material from the specified files.abstract int
Returns CRL timeout, which by default is 20 seconds.abstract SSLContext
Returns theSSLContext
object that will be used in establishing secure connections.abstract int
Returns TLS handshake timeout, which by default is 10 seconds.abstract void
setCrlTimeout
(int crlTimeout) Sets CRL fetch timeout.abstract void
setTlsHandshakeTimeout
(int tlsHandshakeTimeout) Sets TLS handshake timeout.
-
Constructor Details
-
TlsOptions
public TlsOptions()
-
-
Method Details
-
createFromFiles
public static TlsOptions createFromFiles(String clientCredentialsFileName, char[] clientCredentialsPassword, String trustedCertificatesFileName) throws TlsOptions.TlsInitializationException CreatesTlsOptions
using client credentials and trust material from the specified files.- Parameters:
clientCredentialsFileName
- DER encoded PKCS#12 file with client credentialsclientCredentialsPassword
- password for client credentials filetrustedCertificatesFileName
- DER encoded PKCS#7 file with trusted certificates- Returns:
- a new
TlsOptions
object - Throws:
NullPointerException
- 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 material
-
createFromBlobs
public static TlsOptions createFromBlobs(byte[] clientCredentialsRawData, char[] clientCredentialsPassword, byte[] trustedCertificatesRawData) throws TlsOptions.TlsInitializationException CreatesTlsOptions
using client credentials and trust material from the specified byte arrays.- Parameters:
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 certificates- Returns:
- a new
TlsOptions
object - Throws:
NullPointerException
- if any argument is nullTlsOptions.TlsInitializationException
- if there was a problem retrieving the client credentials or trust material
-
create
Creates aTlsOptions
object with the specifiedsslContext
.- Parameters:
sslContext
- a context configured with DER encoded client credentials and DER encoded trusted material- Returns:
- a new
TlsOptions
object - Throws:
NullPointerException
- if argument is null
-
getSslContext
Returns theSSLContext
object that will be used in establishing secure connections.- Returns:
SSLContext
-
getTlsHandshakeTimeout
public abstract int getTlsHandshakeTimeout()Returns TLS handshake timeout, which by default is 10 seconds.- Returns:
- TLS handshake timeout value in milliseconds
-
setTlsHandshakeTimeout
public abstract void setTlsHandshakeTimeout(int tlsHandshakeTimeout) Sets TLS handshake timeout.- Parameters:
tlsHandshakeTimeout
- new timeout duration, a strictly positive number of milliseconds- Throws:
IllegalArgumentException
- if the new timeout is not strictly positive
-
getCrlTimeout
public abstract int getCrlTimeout()Returns CRL timeout, which by default is 20 seconds.- Returns:
- CRL fetch timeout in milliseconds
-
setCrlTimeout
public abstract void setCrlTimeout(int crlTimeout) Sets CRL fetch timeout.- Parameters:
crlTimeout
- new timeout duration, a strictly positive number of milliseconds- Throws:
IllegalArgumentException
- if the new timeout is not strictly positive
-