/**
* @tests javax.net.ssl.CertPathTrustManagerParameters#getParameters()
*/
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "",
method = "getParameters",
args = {}
)
public void test_getParameters() {
CertPathParameters parameters = new MyCertPathParameters();
CertPathTrustManagerParameters p = new CertPathTrustManagerParameters(
parameters);
if (!(p.getParameters() instanceof MyCertPathParameters)) {
fail("incorrect parameters");
}
assertNotSame("Parameters were cloned incorrectly",
parameters, p.getParameters());
}
java类javax.net.ssl.CertPathTrustManagerParameters的实例源码
CertPathTrustManagerParametersTest.java 文件源码
项目:In-the-Box-Fork
阅读 26
收藏 0
点赞 0
评论 0
SSLSupport.java 文件源码
项目:activemq-artemis
阅读 24
收藏 0
点赞 0
评论 0
private static TrustManager[] loadTrustManager(final String trustStoreProvider,
final String trustStorePath,
final String trustStorePassword,
final boolean trustAll,
final String crlPath) throws Exception {
if (trustAll) {
//This is useful for testing but not should be used outside of that purpose
return InsecureTrustManagerFactory.INSTANCE.getTrustManagers();
} else if (trustStorePath == null && (trustStoreProvider == null || !"PKCS11".equals(trustStoreProvider.toUpperCase()))) {
return null;
} else {
TrustManagerFactory trustMgrFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
KeyStore trustStore = SSLSupport.loadKeystore(trustStoreProvider, trustStorePath, trustStorePassword);
boolean ocsp = Boolean.valueOf(Security.getProperty("ocsp.enable"));
boolean initialized = false;
if ((ocsp || crlPath != null) && TrustManagerFactory.getDefaultAlgorithm().equalsIgnoreCase("PKIX")) {
PKIXBuilderParameters pkixParams = new PKIXBuilderParameters(trustStore, new X509CertSelector());
if (crlPath != null) {
pkixParams.setRevocationEnabled(true);
Collection<? extends CRL> crlList = loadCRL(crlPath);
if (crlList != null) {
pkixParams.addCertStore(CertStore.getInstance("Collection", new CollectionCertStoreParameters(crlList)));
}
}
trustMgrFactory.init(new CertPathTrustManagerParameters(pkixParams));
initialized = true;
}
if (!initialized) {
trustMgrFactory.init(trustStore);
}
return trustMgrFactory.getTrustManagers();
}
}
CertPathTrustManagerParametersTest.java 文件源码
项目:In-the-Box-Fork
阅读 30
收藏 0
点赞 0
评论 0
/**
* @tests javax.net.ssl.CertPathTrustManagerParameters#
* CertPathTrustManagerParameters(java.security.cert.CertPathParameters)
* Case 1: Try to construct object.
* Case 2: Check NullPointerException.
*/
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "",
method = "CertPathTrustManagerParameters",
args = {java.security.cert.CertPathParameters.class}
)
public void test_ConstructorLjava_security_cert_CertPathParameters() {
// case 1: Try to construct object.
try {
CertPathParameters parameters = new MyCertPathParameters();
CertPathTrustManagerParameters p =
new CertPathTrustManagerParameters(parameters);
assertNotSame("Parameters were cloned incorrectly",
parameters, p.getParameters());
} catch (Exception e) {
fail("Unexpected exception " + e.toString());
}
// case 2: Check NullPointerException.
try {
new CertPathTrustManagerParameters(null);
fail("Expected CertPathTrustManagerParameters was not thrown");
} catch (NullPointerException npe) {
// expected
}
}
CertPathTrustManagerParametersTest.java 文件源码
项目:cn1
阅读 33
收藏 0
点赞 0
评论 0
public void testCertPathTrustManagerParameters() {
CertPathParameters parameters = new MyCertPathParameters();
CertPathTrustManagerParameters p = new CertPathTrustManagerParameters(
parameters);
if (!(p.getParameters() instanceof MyCertPathParameters)) {
fail("incorrect parameters");
}
}
CertPathTrustManagerParametersTest.java 文件源码
项目:freeVM
阅读 35
收藏 0
点赞 0
评论 0
public void testCertPathTrustManagerParameters() {
CertPathParameters parameters = new MyCertPathParameters();
CertPathTrustManagerParameters p = new CertPathTrustManagerParameters(
parameters);
if (!(p.getParameters() instanceof MyCertPathParameters)) {
fail("incorrect parameters");
}
}
CertPathTrustManagerParametersTest.java 文件源码
项目:freeVM
阅读 35
收藏 0
点赞 0
评论 0
public void testCertPathTrustManagerParameters() {
CertPathParameters parameters = new MyCertPathParameters();
CertPathTrustManagerParameters p = new CertPathTrustManagerParameters(
parameters);
if (!(p.getParameters() instanceof MyCertPathParameters)) {
fail("incorrect parameters");
}
}