Class TlsConfigHelper
- java.lang.Object
-
- io.opentelemetry.exporter.internal.TlsConfigHelper
-
public class TlsConfigHelper extends java.lang.ObjectUtility class to help with management of TLS related components. TLS config consistskeyManager,trustManager, which combine to formsslContext. These components can be configured via higher level APIs (setTrustManagerFromCerts(byte[])andsetKeyManagerFromCerts(byte[], byte[])) which parse keys in PEM format, or the lower level APIsetSslContext(SSLContext, X509TrustManager)in which the components are directly set, but NOT both. Attempts to reconfigure components which have already been configured throwIllegalStateException. Consumers access components via any combination ofgetKeyManager(),getTrustManager(), andgetSslContext().This class is internal and is hence not for public use. Its APIs are unstable and can change at any time.
-
-
Field Summary
Fields Modifier and Type Field Description private javax.net.ssl.X509KeyManagerkeyManagerprivate javax.net.ssl.SSLContextsslContextprivate javax.net.ssl.X509TrustManagertrustManager
-
Constructor Summary
Constructors Constructor Description TlsConfigHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TlsConfigHelpercopy()Return a shallow copy of this instance.javax.net.ssl.X509KeyManagergetKeyManager()Get theX509KeyManager.javax.net.ssl.SSLContextgetSslContext()Get theSSLContext.javax.net.ssl.X509TrustManagergetTrustManager()Get theX509TrustManager.voidsetKeyManagerFromCerts(byte[] privateKeyPem, byte[] certificatePem)Configure theX509KeyManagerfrom the given private key and certificate, both in PEM format.voidsetSslContext(javax.net.ssl.SSLContext sslContext, javax.net.ssl.X509TrustManager trustManager)Configure theSSLContextandX509TrustManager.voidsetTrustManagerFromCerts(byte[] trustedCertsPem)Configure theX509TrustManagerfrom the given cert content.
-
-
-
Method Detail
-
setTrustManagerFromCerts
public void setTrustManagerFromCerts(byte[] trustedCertsPem)
Configure theX509TrustManagerfrom the given cert content.Must not be called multiple times, or if
setSslContext(SSLContext, X509TrustManager)has been previously called.- Parameters:
trustedCertsPem- Certificate in PEM format.
-
setKeyManagerFromCerts
public void setKeyManagerFromCerts(byte[] privateKeyPem, byte[] certificatePem)Configure theX509KeyManagerfrom the given private key and certificate, both in PEM format.Must not be called multiple times, or if
setSslContext(SSLContext, X509TrustManager)has been previously called.- Parameters:
privateKeyPem- Private key content in PEM format.certificatePem- Certificate content in PEM format.
-
setSslContext
public void setSslContext(javax.net.ssl.SSLContext sslContext, javax.net.ssl.X509TrustManager trustManager)Configure theSSLContextandX509TrustManager.Must not be called multiple times, or if
setTrustManagerFromCerts(byte[])orsetKeyManagerFromCerts(byte[], byte[])has been previously called.- Parameters:
sslContext- the SSL context.trustManager- the trust manager.
-
getKeyManager
@Nullable public javax.net.ssl.X509KeyManager getKeyManager()
Get theX509KeyManager.
-
getTrustManager
@Nullable public javax.net.ssl.X509TrustManager getTrustManager()
Get theX509TrustManager.
-
getSslContext
@Nullable public javax.net.ssl.SSLContext getSslContext()
Get theSSLContext.
-
copy
public TlsConfigHelper copy()
Return a shallow copy of this instance.
-
-