Class TlsUtil
- java.lang.Object
-
- io.opentelemetry.exporter.internal.TlsUtil
-
public final class TlsUtil extends java.lang.Object
Utilities for working with TLS.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 static java.lang.String
PEM_KEY_FOOTER
private static java.lang.String
PEM_KEY_HEADER
private static java.util.List<java.security.KeyFactory>
SUPPORTED_KEY_FACTORIES
-
Constructor Summary
Constructors Modifier Constructor Description private
TlsUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description (package private) static byte[]
decodePem(byte[] pem)
(package private) static java.security.PrivateKey
generatePrivateKey(java.security.spec.PKCS8EncodedKeySpec keySpec, java.util.List<java.security.KeyFactory> keyFactories)
static javax.net.ssl.X509KeyManager
keyManager(byte[] privateKeyPem, byte[] certificatePem)
CreatesKeyManager
initiated by keystore containing single private key with matching certificate chain.static javax.net.ssl.X509TrustManager
trustManager(byte[] trustedCertificatesPem)
Returns aTrustManager
for the given trusted certificates.
-
-
-
Field Detail
-
PEM_KEY_HEADER
private static final java.lang.String PEM_KEY_HEADER
- See Also:
- Constant Field Values
-
PEM_KEY_FOOTER
private static final java.lang.String PEM_KEY_FOOTER
- See Also:
- Constant Field Values
-
SUPPORTED_KEY_FACTORIES
private static final java.util.List<java.security.KeyFactory> SUPPORTED_KEY_FACTORIES
-
-
Method Detail
-
keyManager
public static javax.net.ssl.X509KeyManager keyManager(byte[] privateKeyPem, byte[] certificatePem) throws javax.net.ssl.SSLException
CreatesKeyManager
initiated by keystore containing single private key with matching certificate chain.- Throws:
javax.net.ssl.SSLException
-
generatePrivateKey
static java.security.PrivateKey generatePrivateKey(java.security.spec.PKCS8EncodedKeySpec keySpec, java.util.List<java.security.KeyFactory> keyFactories) throws javax.net.ssl.SSLException
- Throws:
javax.net.ssl.SSLException
-
trustManager
public static javax.net.ssl.X509TrustManager trustManager(byte[] trustedCertificatesPem) throws javax.net.ssl.SSLException
Returns aTrustManager
for the given trusted certificates.- Throws:
javax.net.ssl.SSLException
-
decodePem
static byte[] decodePem(byte[] pem)
-
-