use of java.security.cert.X509CRLSelector in project j2objc by google.
the class X509CRLSelector2Test method testGetIssuers.
/**
* getIssuers() method testing. Tests if the method return null in the case
* of not specified issuers, if the returned collection corresponds to the
* specified issuers and this collection is unmodifiable.
*/
public void testGetIssuers() {
X509CRLSelector selector = new X509CRLSelector();
X500Principal iss1 = new X500Principal("O=First Org.");
X500Principal iss2 = new X500Principal("O=Second Org.");
X500Principal iss3 = new X500Principal("O=Third Org.");
assertNull("The collection should be null.", selector.getIssuers());
selector.addIssuer(iss1);
selector.addIssuer(iss2);
Collection<X500Principal> result = selector.getIssuers();
try {
result.add(iss3);
fail("The returned collection should be unmodifiable.");
} catch (UnsupportedOperationException e) {
}
assertTrue("The collection should contain the specified DN.", result.contains(iss2));
}
use of java.security.cert.X509CRLSelector in project j2objc by google.
the class X509CRLSelector2Test method testGetCertificateCheckingLjava_X509Certificate.
/**
* getCertificateChecking() method testing.
*/
public void testGetCertificateCheckingLjava_X509Certificate() throws CertificateException {
X509CRLSelector selector = new X509CRLSelector();
CertificateFactory certFact = CertificateFactory.getInstance("X509");
X509Certificate cert = (X509Certificate) certFact.generateCertificate(new ByteArrayInputStream(TestUtils.getX509Certificate_v3()));
selector.setCertificateChecking(cert);
assertEquals(cert, selector.getCertificateChecking());
selector.setCertificateChecking(null);
assertNull(selector.getCertificateChecking());
}
use of java.security.cert.X509CRLSelector in project j2objc by google.
the class X509CRLSelector2Test method testSetCertificateCheckingLjava_X509Certificate.
/**
* setCertificateChecking(X509Certificate) method testing.
*/
public void testSetCertificateCheckingLjava_X509Certificate() throws CertificateException {
X509CRLSelector selector = new X509CRLSelector();
CertificateFactory certFact = CertificateFactory.getInstance("X509");
X509Certificate cert = (X509Certificate) certFact.generateCertificate(new ByteArrayInputStream(TestUtils.getX509Certificate_v3()));
TestCRL crl = new TestCRL();
selector.setCertificateChecking(cert);
assertTrue("The CRL should match the selection criteria.", selector.match(crl));
assertEquals(cert, selector.getCertificateChecking());
selector.setCertificateChecking(null);
assertTrue("The CRL should match the selection criteria.", selector.match(crl));
assertNull(selector.getCertificateChecking());
}
use of java.security.cert.X509CRLSelector in project j2objc by google.
the class X509CRLSelector2Test method testX509CRLSelector.
/**
* constructor testing.
*/
public void testX509CRLSelector() {
X509CRLSelector selector = new X509CRLSelector();
assertNull(selector.getDateAndTime());
assertNull(selector.getCertificateChecking());
assertNull(selector.getIssuerNames());
assertNull(selector.getIssuers());
assertNull(selector.getMaxCRL());
assertNull(selector.getMinCRL());
}
use of java.security.cert.X509CRLSelector in project j2objc by google.
the class X509CRLSelector2Test method testGetMinCRL.
/**
* getMinCRL() method testing. Tests if the method return null in the case
* of not specified minCRL criteria, and if the returned value corresponds
* to the specified one.
*/
public void testGetMinCRL() {
X509CRLSelector selector = new X509CRLSelector();
assertNull("Initially the minCRL should be null.", selector.getMinCRL());
BigInteger minCRL = new BigInteger("10000");
selector.setMinCRLNumber(minCRL);
assertTrue("The result should be equal to specified.", minCRL.equals(selector.getMinCRL()));
}
Aggregations