java.security.cert.X509CRLSelector#getIssuerNames()源码实例Demo

下面列出了java.security.cert.X509CRLSelector#getIssuerNames() 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: j2objc   文件: X509CRLSelector2Test.java
/**
 * 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());
}
 
源代码2 项目: j2objc   文件: X509CRLSelectorTest.java
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());
}