当前位置: 首页>>代码示例>>Java>>正文


Java SSLContextSpi类代码示例

本文整理汇总了Java中javax.net.ssl.SSLContextSpi的典型用法代码示例。如果您正苦于以下问题:Java SSLContextSpi类的具体用法?Java SSLContextSpi怎么用?Java SSLContextSpi使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SSLContextSpi类属于javax.net.ssl包,在下文中一共展示了SSLContextSpi类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: test_createSSLEngine

import javax.net.ssl.SSLContextSpi; //导入依赖的package包/类
/**
 * @throws KeyManagementException
 * @tests javax.net.ssl.SSLContext#createSSLEngine()
 */
@TestTargetNew(
    level = TestLevel.SUFFICIENT,
    notes = "UnsupportedOperationException checking missed",
    method = "createSSLEngine",
    args = {}
)
public void test_createSSLEngine() throws KeyManagementException {
    if (!DEFSupported) fail(NotSupportMsg);
    SSLContextSpi spi = new MySSLContextSpi();
    SSLContext sslContext = new MySslContext(spi, defaultProvider,
            defaultProtocol);
    sslContext.init(null, null, new SecureRandom());
    SSLEngine sslEngine = sslContext.createSSLEngine();
    assertNotNull("SSL engine is null", sslEngine);
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:20,代码来源:SSLContext1Test.java

示例2: test_createSSLEngineLjava_lang_StringI

import javax.net.ssl.SSLContextSpi; //导入依赖的package包/类
/**
 * @throws KeyManagementException
 * @tests javax.net.ssl.SSLContext#createSSLEngine(java.lang.String, int)
 */
@TestTargetNew(
    level = TestLevel.SUFFICIENT,
    notes = "UnsupportedOperationException checking missed",
    method = "createSSLEngine",
    args = {java.lang.String.class, int.class}
)
public void test_createSSLEngineLjava_lang_StringI()
    throws KeyManagementException {
    if (!DEFSupported) fail(NotSupportMsg);
    SSLContextSpi spi = new MySSLContextSpi();
    SSLContext sslContext = new MySslContext(spi, defaultProvider,
            defaultProtocol);
    sslContext.init(null, null, new SecureRandom());
    SSLEngine sslEngine = sslContext.createSSLEngine("www.fortify.net", 80);
    assertNotNull("SSL engine is null", sslEngine);
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:21,代码来源:SSLContext1Test.java

示例3: test_getProvider

import javax.net.ssl.SSLContextSpi; //导入依赖的package包/类
/**
 * @throws NoSuchAlgorithmException
 * @throws NoSuchProviderException
 * @tests javax.net.ssl.SSLContext#getProvider()
 */
@TestTargetNew(
    level = TestLevel.COMPLETE,
    notes = "",
    method = "getProvider",
    args = {}
)
public void test_getProvider()
    throws NoSuchAlgorithmException, NoSuchProviderException {
    if (!DEFSupported) fail(NotSupportMsg);
    SSLContextSpi spi = new MySSLContextSpi();
    SSLContext sslContext = new MySslContext(spi, defaultProvider,
            defaultProtocol);
    assertEquals("Incorrect provider",
            defaultProvider, sslContext.getProvider());
    sslContext = SSLContext.getInstance(defaultProtocol, defaultProvider);
    assertEquals("Incorrect provider",
            defaultProvider, sslContext.getProvider());
    sslContext = SSLContext.getInstance(defaultProtocol, defaultProviderName);
    assertEquals("Incorrect provider",
            defaultProvider, sslContext.getProvider());
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:27,代码来源:SSLContext1Test.java

示例4: test_Constructor

import javax.net.ssl.SSLContextSpi; //导入依赖的package包/类
/**
 * @tests javax.net.ssl.SSLContextSpi#SSLContextSpi()
 */
@TestTargetNew(
    level = TestLevel.COMPLETE,
    notes = "",
    method = "SSLContextSpi",
    args = {}
)
public void test_Constructor() {
    try {
        SSLContextSpiImpl ssl = new SSLContextSpiImpl();
        assertTrue(ssl instanceof SSLContextSpi);
    } catch (Exception e) {
        fail("Unexpected exception " + e.toString());
    }
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:18,代码来源:SSLContextSpiTest.java

示例5: test_getProtocol

import javax.net.ssl.SSLContextSpi; //导入依赖的package包/类
/**
 * @throws NoSuchAlgorithmException
 * @throws NoSuchProviderException
 * @tests javax.net.ssl.SSLContext#getProtocol()
 */
@TestTargetNew(
    level = TestLevel.COMPLETE,
    notes = "",
    method = "getProtocol",
    args = {}
)
public void test_getProtocol()
    throws NoSuchAlgorithmException, NoSuchProviderException {
    if (!DEFSupported) fail(NotSupportMsg);
    SSLContextSpi spi = new MySSLContextSpi();
    SSLContext sslContext = new MySslContext(spi, defaultProvider,
            defaultProtocol);
    assertEquals("Incorrect protocol",
            defaultProtocol, sslContext.getProtocol());
    sslContext = new MySslContext(spi, defaultProvider,
            null);
    assertNull("Incorrect protocol", sslContext.getProtocol());
    sslContext = SSLContext.getInstance(defaultProtocol);
    assertEquals("Incorrect protocol",
            defaultProtocol, sslContext.getProtocol());
    sslContext = SSLContext.getInstance(defaultProtocol, defaultProvider);
    assertEquals("Incorrect protocol",
            defaultProtocol, sslContext.getProtocol());
    sslContext = SSLContext.getInstance(defaultProtocol, defaultProviderName);
    assertEquals("Incorrect protocol",
            defaultProtocol, sslContext.getProtocol());
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:33,代码来源:SSLContext1Test.java

示例6: getX509TrustManager

import javax.net.ssl.SSLContextSpi; //导入依赖的package包/类
private X509TrustManager getX509TrustManager(
		Lookup<ConnectionSocketFactory> socketFactoryRegistry) {
	ConnectionSocketFactory connectionSocketFactory = socketFactoryRegistry
			.lookup("https");
	SSLSocketFactory sslSocketFactory = getField(connectionSocketFactory,
			"socketfactory");
	SSLContextSpi sslContext = getField(sslSocketFactory, "context");
	return getField(sslContext, "trustManager");
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-commons,代码行数:10,代码来源:DefaultApacheHttpClientConnectionManagerFactoryTests.java

示例7: newPreferredSSLContextSpi

import javax.net.ssl.SSLContextSpi; //导入依赖的package包/类
/**
 * Constructs a new instance of the preferred {@link SSLContextSpi}.
 */
public static SSLContextSpi newPreferredSSLContextSpi() {
    checkAvailability();
    return OpenSSLContextImpl.getPreferred();
}
 
开发者ID:google,项目名称:conscrypt,代码行数:8,代码来源:Conscrypt.java

示例8: TealessSSLContext

import javax.net.ssl.SSLContextSpi; //导入依赖的package包/类
TealessSSLContext(SSLContextSpi sslContextSpi, Provider provider, String s) {
  super(sslContextSpi, provider, s);
}
 
开发者ID:elastic,项目名称:tealess,代码行数:4,代码来源:TealessSSLContext.java

示例9: create

import javax.net.ssl.SSLContextSpi; //导入依赖的package包/类
public static SSLContext create(SSLContextSpi sslContextSpi, Provider provider, String s) {
  return new TealessSSLContext(sslContextSpi, provider, s);
}
 
开发者ID:elastic,项目名称:tealess,代码行数:4,代码来源:TealessSSLContext.java

示例10: if

import javax.net.ssl.SSLContextSpi; //导入依赖的package包/类
/**
  * @throws NoSuchAlgorithmException
 * @throws KeyStoreException
 * @throws FileNotFoundException
 * @throws KeyManagementException
 * @tests javax.net.ssl.SSLContext#
  *     init(javax.net.ssl.KeyManager[], javax.net.ssl.TrustManager[],
  *     java.security.SecureRandom)
  */
@TestTargetNew(
    level = TestLevel.COMPLETE,
    notes = "",
    method = "init",
    args = {javax.net.ssl.KeyManager[].class, javax.net.ssl.TrustManager[].class, java.security.SecureRandom.class}
)
 public void test_init$Ljavax_net_ssl_KeyManager$Ljavax_net_ssl_TrustManagerLjava_security_SecureRandom()
     throws Exception {
     if (!DEFSupported) fail(NotSupportMsg);
     SSLContextSpi spi = new MySSLContextSpi();
     SSLContext sslContext = new MySslContext(spi, defaultProvider,
             defaultProtocol);
     try {
         sslContext.createSSLEngine();
         fail("Expected RuntimeException was not thrown");
     } catch (RuntimeException rte) {
         // expected
     }

     try {
         sslContext.init(null, null, null);
         fail("KeyManagementException wasn't thrown");
     } catch (KeyManagementException kme) {
         //expected
     }

     try {
         String tAlg = TrustManagerFactory.getDefaultAlgorithm();
         String kAlg = KeyManagerFactory.getDefaultAlgorithm();
         if (tAlg == null)
             fail("TrustManagerFactory default algorithm is not defined");
         if (kAlg == null)
             fail("KeyManagerFactory default algorithm is not defined");
         KeyManagerFactory kmf = KeyManagerFactory.getInstance(kAlg);
         kmf.init(null, new char[11]);
         TrustManagerFactory tmf = TrustManagerFactory.getInstance(tAlg);
         KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
         tmf.init(ks);
         TrustManager[] tms = tmf.getTrustManagers();
         sslContext.init(kmf.getKeyManagers(), tms, new SecureRandom());
     } catch (Exception e) {
         System.out.println("EE = " + e);
     }
 }
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:54,代码来源:SSLContext1Test.java

示例11: MySslContext

import javax.net.ssl.SSLContextSpi; //导入依赖的package包/类
public MySslContext(SSLContextSpi spi, Provider prov, String alg) {
    super(spi, prov, alg);
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:4,代码来源:SSLContext1Test.java

示例12: MySSLContext

import javax.net.ssl.SSLContextSpi; //导入依赖的package包/类
public MySSLContext(SSLContextSpi spi, Provider prov, String alg) {
    super(spi, prov, alg);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:4,代码来源:SSLContext1Test.java

示例13: getX509TrustManager

import javax.net.ssl.SSLContextSpi; //导入依赖的package包/类
private X509TrustManager getX509TrustManager(Lookup<ConnectionSocketFactory> socketFactoryRegistry) {
	ConnectionSocketFactory connectionSocketFactory = (ConnectionSocketFactory)socketFactoryRegistry.lookup("https");
	SSLSocketFactory sslSocketFactory = (SSLSocketFactory)this.getField(connectionSocketFactory, "socketfactory");
	SSLContextSpi sslContext = (SSLContextSpi)this.getField(sslSocketFactory, "context");
	return (X509TrustManager)this.getField(sslContext, "trustManager");
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:7,代码来源:FeignHttpClientConfigurationTests.java

示例14: mySSLContext

import javax.net.ssl.SSLContextSpi; //导入依赖的package包/类
public mySSLContext(SSLContextSpi spi, Provider prov, String alg) {
    super(spi, prov, alg);
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:4,代码来源:SSLContext1Test.java


注:本文中的javax.net.ssl.SSLContextSpi类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。