com.emc.mongoose.api.common.net.ssl.SslContext Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mongoose-api-common Show documentation
Show all versions of mongoose-api-common Show documentation
Mongoose is a high-load storage performance testing tool
package com.emc.mongoose.api.common.net.ssl;
import com.emc.mongoose.api.common.exception.OmgDoesNotPerformException;
import com.emc.mongoose.api.common.exception.Fireball;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
/**
Created by kurila on 12.05.16.
*/
public final class SslContext {
private SslContext() {}
private static SSLContext getInstance()
throws OmgDoesNotPerformException {
try {
final SSLContext sslContext = SSLContext.getInstance("TLS");
sslContext.init(
null, new TrustManager[] { X509TrustAllManager.INSTANCE }, new SecureRandom()
);
return sslContext;
} catch(final NoSuchAlgorithmException | KeyManagementException e) {
throw new OmgDoesNotPerformException(e);
}
}
public static volatile SSLContext INSTANCE;
static {
try {
INSTANCE = getInstance();
} catch(final Fireball e) {
e.printStackTrace(System.err);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy