Java Code Examples for java.security.cert.X509CRLSelector#setMaxCRLNumber()

The following examples show how to use java.security.cert.X509CRLSelector#setMaxCRLNumber() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: X509CRLSelector2Test.java    From j2objc with Apache License 2.0 6 votes vote down vote up
/**
 * setMaxCRLNumber(BigInteger maxCRL) method testing. Tests if CRLs with any
 * crl number value match the selector in the case of null crlNumber
 * criteria, if specified maxCRL value matches the selector, and if CRL with
 * inappropriate crlNumber value does not match the selector.
 */
public void testSetMaxCRLNumberLjava_math_BigInteger() {
    X509CRLSelector selector = new X509CRLSelector();
    BigInteger maxCRL = new BigInteger("10000");
    TestCRL crl = new TestCRL(maxCRL);

    selector.setMaxCRLNumber(null);
    assertTrue("Any CRL should match in the case of null minCRLNumber.",
            selector.match(crl));
    selector.setMaxCRLNumber(maxCRL);
    assertTrue("The CRL should match the selection criteria.", selector
            .match(crl));
    selector.setMaxCRLNumber(new BigInteger("9999"));
    assertFalse("The CRL should not match the selection criteria.",
            selector.match(crl));
}
 
Example 2
Source File: X509CRLSelector2Test.java    From j2objc with Apache License 2.0 6 votes vote down vote up
public void testToString() {
    X509CRLSelector selector = new X509CRLSelector();
    X500Principal iss1 = new X500Principal("O=First Org.");
    X500Principal iss2 = new X500Principal("O=Second Org.");
    BigInteger minCRL = new BigInteger("10000");
    BigInteger maxCRL = new BigInteger("10000");
    Date date = new Date(200);

    selector.addIssuer(iss1);
    selector.addIssuer(iss2);
    selector.setMinCRLNumber(minCRL);
    selector.setMaxCRLNumber(maxCRL);
    selector.setDateAndTime(date);

    assertNotNull("The result should not be null.", selector.toString());
}
 
Example 3
Source File: X509CRLSelector2Test.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * getMaxCRL() method testing. Tests if the method return null in the case
 * of not specified maxCRL criteria, and if the returned value corresponds
 * to the specified one.
 */
public void testGetMaxCRL() {
    X509CRLSelector selector = new X509CRLSelector();
    assertNull("Initially the maxCRL should be null.", selector.getMaxCRL());
    BigInteger maxCRL = new BigInteger("10000");
    selector.setMaxCRLNumber(maxCRL);
    assertTrue("The result should be equal to specified.", maxCRL
            .equals(selector.getMaxCRL()));
}
 
Example 4
Source File: X509CRLSelector2Test.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * clone() method testing. Tests if the selector is cloned correctly: the
 * crl which matche to the initial selector should match to the clone and
 * the change of clone should not cause the change of initial selector.
 */
public void testClone() {
    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.");
    BigInteger minCRL = new BigInteger("10000");
    BigInteger maxCRL = new BigInteger("10000");
    Date date = new Date(200);

    selector.addIssuer(iss1);
    selector.addIssuer(iss2);
    selector.setMinCRLNumber(minCRL);
    selector.setMaxCRLNumber(maxCRL);
    selector.setDateAndTime(date);

    X509CRLSelector clone = (X509CRLSelector) selector.clone();
    TestCRL crl = new TestCRL(iss1);
    crl.setCrlNumber(minCRL);
    crl.setUpdateDates(new Date(200), new Date(200));
    assertTrue("The specified CRL should match the clone selector.",
            selector.match(crl));

    clone.addIssuer(iss3);
    assertFalse("The changes of the clone selector should not cause "
            + "the changes of initial object", selector.getIssuerNames()
            .size() == 3);
}