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

The following examples show how to use java.security.cert.X509CRLSelector#getIssuerNames() . 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
/**
 * getIssuerNames() method testing. Tests if the method return null in the
 * case of not specified issuers, if the returned collection corresponds to
 * the specified issuers.
 */
public void testGetIssuerNames() {
    X509CRLSelector selector = new X509CRLSelector();
    byte[] iss1 = new byte[]
    // manually obtained DER encoding of "O=First Org." issuer name;
    { 48, 21, 49, 19, 48, 17, 6, 3, 85, 4, 10, 19, 10, 70, 105, 114, 115,
            116, 32, 79, 114, 103, 46 };
    byte[] iss2 = new byte[]
    // manually obtained DER encoding of "O=Second Org." issuer name;
    { 48, 22, 49, 20, 48, 18, 6, 3, 85, 4, 10, 19, 11, 83, 101, 99, 111,
            110, 100, 32, 79, 114, 103, 46 };
    assertNull("The collection should be null.", selector.getIssuerNames());
    try {
        selector.addIssuerName(iss1);
        selector.addIssuerName(iss2);
    } catch (IOException e) {
        e.printStackTrace();
        fail("Unexpected IOException was thrown.");
    }
    Collection<Object> result = selector.getIssuerNames();
    assertEquals("The collection should contain all of the specified DNs.",
            2, result.size());
}
 
Example 2
Source File: X509CRLSelectorTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
public void testGetIssuersNamesCopy() {
    X509CRLSelector crlSelector = new X509CRLSelector();
    crlSelector.addIssuer(PRINCIPAL);
    Collection<Object> issuers = crlSelector.getIssuerNames();
    assertEquals(1, issuers.size());
    issuers.clear();
    assertEquals(0, issuers.size());
}