Package com.linkedin.venice.utils
Class SslUtils
- java.lang.Object
-
- com.linkedin.venice.utils.SslUtils
-
public class SslUtils extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SslUtils.VeniceTlsConfiguration
This class is used to configure TLS for Venice components in integration tests.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
LOCAL_KEYSTORE_JKS
static java.lang.String
LOCAL_PASSWORD
Self-signed cert.
-
Constructor Summary
Constructors Constructor Description SslUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
getPathForResource(java.lang.String resource)
This function should be used in test cases only.static SSLFactory
getSSLFactory(java.util.Properties sslProperties, java.lang.String factoryClassName)
A helper function that return an instance ofSSLFactory
with ssl Properties.static SslUtils.VeniceTlsConfiguration
getTlsConfiguration()
static SSLFactory
getVeniceLocalSslFactory()
This function should be used in test cases only.static java.util.Properties
getVeniceLocalSslProperties()
This function should be used in test cases only.static java.security.cert.X509Certificate
getX509Certificate(java.security.cert.Certificate certificate)
static boolean
isConscryptAvailable()
Check whether openssl provider is available or not.static java.util.Properties
loadSSLConfig(java.lang.String configFilePath)
Build an instance ofProperties
with a file path to SSL config file.static SSLEngineFactoryImpl.Config
toAlpiniSSLConfig(SSLConfig sslConfig)
static SslFactory
toAlpiniSSLFactory(SSLFactory sslFactory)
static SslFactory
toAlpiniSSLFactory(SSLFactory sslFactory, boolean openssl)
static SSLFactory
toSSLFactoryWithOpenSSLSupport(SSLFactory sslFactory)
Adapt the incomingSSLFactory
into a new one backed by openssl if it is available.
-
-
-
Field Detail
-
LOCAL_PASSWORD
public static final java.lang.String LOCAL_PASSWORD
Self-signed cert. Use keystore as truststore since self-signed. Cert has CN=localhost IMPORTANT NOTE: the "localhost.jks", "localhost.cert", "localhost.key" and "localhost.p12" files only exist in the code base; do not try to load this files in actual hosts- See Also:
- Constant Field Values
-
LOCAL_KEYSTORE_JKS
public static final java.lang.String LOCAL_KEYSTORE_JKS
- See Also:
- Constant Field Values
-
-
Method Detail
-
getVeniceLocalSslFactory
public static SSLFactory getVeniceLocalSslFactory()
This function should be used in test cases only.- Returns:
- a local SSL factory that uses a self-signed development certificate.
-
getVeniceLocalSslProperties
public static java.util.Properties getVeniceLocalSslProperties()
This function should be used in test cases only.- Returns:
- an instance of
Properties
that contains local SSL configs.
-
getTlsConfiguration
public static SslUtils.VeniceTlsConfiguration getTlsConfiguration()
-
getPathForResource
public static java.lang.String getPathForResource(java.lang.String resource)
This function should be used in test cases only.- Parameters:
resource
- -- System resource name- Returns:
- the path to the local key store location
-
toAlpiniSSLFactory
public static SslFactory toAlpiniSSLFactory(SSLFactory sslFactory)
-
toAlpiniSSLFactory
public static SslFactory toAlpiniSSLFactory(SSLFactory sslFactory, boolean openssl)
-
toSSLFactoryWithOpenSSLSupport
public static SSLFactory toSSLFactoryWithOpenSSLSupport(SSLFactory sslFactory)
Adapt the incomingSSLFactory
into a new one backed by openssl if it is available.
-
isConscryptAvailable
public static boolean isConscryptAvailable()
Check whether openssl provider is available or not.
-
toAlpiniSSLConfig
public static SSLEngineFactoryImpl.Config toAlpiniSSLConfig(SSLConfig sslConfig)
-
getSSLFactory
public static SSLFactory getSSLFactory(java.util.Properties sslProperties, java.lang.String factoryClassName)
A helper function that return an instance ofSSLFactory
with ssl Properties.- Parameters:
sslProperties
-factoryClassName
- Different products can plug-in different factory classes.
-
loadSSLConfig
public static java.util.Properties loadSSLConfig(java.lang.String configFilePath) throws java.io.IOException
Build an instance ofProperties
with a file path to SSL config file. An example of SSL config file: ssl.enabled:true ssl.key.password:local_password ssl.keystore.location:./identity.p12 ssl.keystore.password:local_password ssl.keystore.type:pkcs12 ssl.truststore.location:./cacerts ssl.truststore.password:local_password- Throws:
java.io.IOException
-
getX509Certificate
public static java.security.cert.X509Certificate getX509Certificate(java.security.cert.Certificate certificate)
-
-