use of java.security.cert.CollectionCertStoreParameters in project j2objc by google.
the class CollectionCertStoreParametersTest method testCollectionCertStoreParametersCollection01.
/**
* Test #1 for <code>CollectionCertStoreParameters(Collection)</code>
* constructor<br>
*/
public final void testCollectionCertStoreParametersCollection01() {
Vector<Certificate> certificates = new Vector<Certificate>();
certificates.add(new MyCertificate("TEST", new byte[] {}));
new CollectionCertStoreParameters(certificates);
}
use of java.security.cert.CollectionCertStoreParameters in project j2objc by google.
the class CollectionCertStoreParametersTest method testClone02.
/**
* Test #2 for <code>clone()</code> method<br>
*/
public final void testClone02() {
Vector<Certificate> certificates = new Vector<Certificate>();
certificates.add(new MyCertificate("TEST", new byte[] { (byte) 4 }));
CollectionCertStoreParameters cp1 = new CollectionCertStoreParameters(certificates);
CollectionCertStoreParameters cp2 = (CollectionCertStoreParameters) cp1.clone();
// check that both objects hold the same reference
assertTrue(cp1.getCollection() == cp2.getCollection());
}
use of java.security.cert.CollectionCertStoreParameters in project j2objc by google.
the class CollectionCertStoreParametersTest method testCollectionCertStoreParameters02.
/**
* Test #2 for <code>CollectionCertStoreParameters</code> constructor<br>
*/
@SuppressWarnings("unchecked")
public final void testCollectionCertStoreParameters02() {
CollectionCertStoreParameters cp = new CollectionCertStoreParameters();
Collection c = cp.getCollection();
assertTrue("isEmpty", c.isEmpty());
// check that empty collection is immutable
try {
// try to modify it
c.add(new Object());
fail("empty collection must be immutable");
} catch (Exception e) {
}
}
use of java.security.cert.CollectionCertStoreParameters in project j2objc by google.
the class CollectionCertStoreParametersTest method testGetCollection02.
/**
* Test #2 for <code>getCollection()</code> method<br>
*/
public final void testGetCollection02() {
Vector certificates = new Vector();
CollectionCertStoreParameters cp = new CollectionCertStoreParameters(certificates);
assertNotNull(cp.getCollection());
}
use of java.security.cert.CollectionCertStoreParameters in project Payara by payara.
the class JSSE14SocketFactory method getParameters.
/**
* Return the initialization parameters for the TrustManager. Currently, only the default <code>PKIX</code> is
* supported.
*
* @param algorithm The algorithm to get parameters for.
* @param crlf The path to the CRL file.
* @param trustStore The configured TrustStore.
*
* @return The parameters including the CRLs and TrustStore.
*/
protected CertPathParameters getParameters(String algorithm, String crlf, KeyStore trustStore) throws Exception {
CertPathParameters params;
if ("PKIX".equalsIgnoreCase(algorithm)) {
PKIXBuilderParameters xparams = new PKIXBuilderParameters(trustStore, new X509CertSelector());
Collection crls = getCRLs(crlf);
CertStoreParameters csp = new CollectionCertStoreParameters(crls);
CertStore store = CertStore.getInstance("Collection", csp);
xparams.addCertStore(store);
xparams.setRevocationEnabled(true);
String trustLength = (String) attributes.get("trustMaxCertLength");
if (trustLength != null) {
try {
xparams.setMaxPathLength(Integer.parseInt(trustLength));
} catch (Exception ex) {
logger.warning("Bad maxCertLength: " + trustLength);
}
}
params = xparams;
} else {
throw new CRLException("CRLs not supported for type: " + algorithm);
}
return params;
}
Aggregations