本文整理汇总了Java中org.apache.http.conn.ssl.SSLInitializationException类的典型用法代码示例。如果您正苦于以下问题:Java SSLInitializationException类的具体用法?Java SSLInitializationException怎么用?Java SSLInitializationException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SSLInitializationException类属于org.apache.http.conn.ssl包,在下文中一共展示了SSLInitializationException类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getPreferredSslContext
import org.apache.http.conn.ssl.SSLInitializationException; //导入依赖的package包/类
private static SSLContext getPreferredSslContext() {
try {
final SSLContext sslcontext = SSLContext.getInstance("TLS");
// http://download.java.net/jdk9/docs/technotes/guides/security/jsse/JSSERefGuide.html
sslcontext.init(null, null, null);
return sslcontext;
} catch (final NoSuchAlgorithmException | KeyManagementException ex) {
throw new SSLInitializationException(ex.getMessage(), ex);
}
}
开发者ID:aws,项目名称:aws-sdk-java-v2,代码行数:11,代码来源:ApacheConnectionManagerFactory.java
示例2: checkAndInit
import org.apache.http.conn.ssl.SSLInitializationException; //导入依赖的package包/类
/**
* @throws SSLInitializationException
*/
private static SchemeLayeredSocketFactory checkAndInit() throws SSLInitializationException {
log.info("Setting up HTTPS TrustAll Socket Factory");
try {
return new HC4TrustAllSSLSocketFactory();
} catch (GeneralSecurityException e) {
log.warn("Failed to initialise HTTPS HC4TrustAllSSLSocketFactory", e);
return SSLSocketFactory.getSocketFactory();
}
}
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:13,代码来源:LazySchemeSocketFactory.java
示例3: getDefaultContext
import org.apache.http.conn.ssl.SSLInitializationException; //导入依赖的package包/类
/**
* The default SSLContext implementation.
* <p>
* Creates a SSLContext with a TrustManager implementation for managing the specified <i>TrustStore</i> file.
* The information to access the TrustStore file must be provided through the {@link SDKConfiguration} parameter.
* These information include the path to the file, its password and the type. Currently, the only type supported
* is the default type JKS.
* </p>
*
* @param config SDK configuration containing SSL properties that will be used to create the context.
* These properties comprehends the path to the TrustSore file and its password.
* @return {@link SSLContext}
*/
private static SSLContext getDefaultContext(SDKConfiguration config) {
try {
File trustStore = new File(config.getTrustStoreFile());
SSLContext context = SSLContextBuilder.create()
.loadTrustMaterial(trustStore, config.getTrustStorePassword().toCharArray())
.build();
return context;
} catch (GeneralSecurityException | IOException e) {
throw new SSLInitializationException(e.getMessage(), e);
}
}
开发者ID:HewlettPackard,项目名称:oneview-sdk-java,代码行数:27,代码来源:SSLContextFactory.java
示例4: getTrustAllContext
import org.apache.http.conn.ssl.SSLInitializationException; //导入依赖的package包/类
/**
* This SSLContext bypass any server validation which means that no verification is made to check
* whether the response came from the real server or from a fake one.
* <p>
* <b>This implementation is only intent for testing purposes.
* Do not use it in a production environment!</b>
* </p>
* @return {@link SSLContext}
*/
private static SSLContext getTrustAllContext() {
try {
SSLContext context = SSLContext.getInstance(SSLConnectionSocketFactory.TLS);
context.init(null, new TrustManager[]{ new TrustAllX509TrustManager() }, new SecureRandom());
return context;
} catch (GeneralSecurityException e) {
throw new SSLInitializationException(e.getMessage(), e);
}
}
开发者ID:HewlettPackard,项目名称:oneview-sdk-java,代码行数:21,代码来源:SSLContextFactory.java
示例5: getAvailableContext
import org.apache.http.conn.ssl.SSLInitializationException; //导入依赖的package包/类
/**
* Uses the current JVM SSL context.
* <br>
* The context can be configured/modified by setting the following properties:
* <ul>
* <li>javax.net.ssl.trustStore</li>
* <li>javax.net.ssl.trustStorePassword</li>
* <li>javax.net.ssl.trustStoreType</li>
* </ul>
* Below is an example that illustrates how these values can be configured programmatically:
* <pre>{@code
* System.setProperty("javax.net.ssl.trustStore", path_to_file);
* System.setProperty("javax.net.ssl.trustStorePassword", password);
* System.setProperty("javax.net.ssl.trustStoreType", type);
* System.setProperty("https.protocol", "TLSv1.2");
* }
* </pre>
*
* Be aware that once these values have been modified, the JVM will use them to verify
* connections against any HTTPS (or other SSL connection). Thus, their modification can
* cause issues when using the SDK within a application which also connects to others
* SSL enabled services.
* <br>
* If a trust store location is not specified using this properties,
* the SunJSSE implementation searches for and uses a keystore file in the
* following locations (in order):
* <ul>
* <li>$JAVA_HOME/lib/security/jssecacerts</li>
* <li>$JAVA_HOME/lib/security/cacerts</li>
* </ul>
*
* @return {@link SSLContext}
*/
private static SSLContext getAvailableContext() {
try {
SSLContext context = SSLContext.getInstance(SSLConnectionSocketFactory.TLS);
context.init(null, null, new SecureRandom());
return context;
} catch (GeneralSecurityException e) {
throw new SSLInitializationException(e.getMessage(), e);
}
}
开发者ID:HewlettPackard,项目名称:oneview-sdk-java,代码行数:45,代码来源:SSLContextFactory.java
注:本文中的org.apache.http.conn.ssl.SSLInitializationException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论