当前位置: 首页>>代码示例>>Java>>正文


Java X509CRLSelector.addIssuerName方法代码示例

本文整理汇总了Java中java.security.cert.X509CRLSelector.addIssuerName方法的典型用法代码示例。如果您正苦于以下问题:Java X509CRLSelector.addIssuerName方法的具体用法?Java X509CRLSelector.addIssuerName怎么用?Java X509CRLSelector.addIssuerName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.security.cert.X509CRLSelector的用法示例。


在下文中一共展示了X509CRLSelector.addIssuerName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: X509CRLSelector

import java.security.cert.X509CRLSelector; //导入方法依赖的package包/类
/**
 * @tests java.security.cert.X509CRLSelector#addIssuerName(byte[])
 */
@TestTargetNew(
    level = TestLevel.PARTIAL_COMPLETE,
    notes = "Verifies IOException.",
    method = "addIssuerName",
    args = {byte[].class}
)
public void test_addIssuerName$B_3() throws Exception {
    //Regression for HARMONY-465
    X509CRLSelector obj = new X509CRLSelector();
    try {
        obj.addIssuerName(new byte[] { (byte) 2, (byte) 3, (byte) 4 });
        fail("IOException expected");
    } catch (IOException e) {
        // expected
    }
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:20,代码来源:X509CRLSelectorTest.java

示例2: test_addIssuerNameLjava_lang_String02

import java.security.cert.X509CRLSelector; //导入方法依赖的package包/类
/**
 * @tests java.security.cert.X509CRLSelector#addIssuerName(java.lang.String)
 */
@TestTargetNew(
    level = TestLevel.PARTIAL_COMPLETE,
    notes = "Verifies null as a parameter.",
    method = "addIssuerName",
    args = {java.lang.String.class}
)
public void test_addIssuerNameLjava_lang_String02() throws IOException {
    // Regression for HARMONY-736
    X509CRLSelector selector = new X509CRLSelector();

    // no exception for null
    selector.addIssuerName((String) null);
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:17,代码来源:X509CRLSelectorTest.java

示例3: testGetIssuerNames

import java.security.cert.X509CRLSelector; //导入方法依赖的package包/类
/**
 * 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.
 */
@TestTargetNew(
    level = TestLevel.COMPLETE,
    notes = "",
    method = "getIssuerNames",
    args = {}
)
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());
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:34,代码来源:X509CRLSelector2Test.java

示例4: X509CRLSelector

import java.security.cert.X509CRLSelector; //导入方法依赖的package包/类
/**
 * @tests java.security.cert.X509CRLSelector#addIssuerName(byte[])
 */
public void test_addIssuerName$B_3() throws Exception {
    //Regression for HARMONY-465
    X509CRLSelector obj = new X509CRLSelector();
    try {
        obj.addIssuerName(new byte[] { (byte) 2, (byte) 3, (byte) 4 });
        fail("IOException expected");
    } catch (IOException e) {
        // expected
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:14,代码来源:X509CRLSelectorTest.java

示例5: testAddIssuerName

import java.security.cert.X509CRLSelector; //导入方法依赖的package包/类
/**
 * @tests addIssuerName(String name)
 */
public void testAddIssuerName() throws IOException {
    //Regression for HARMONY-736
    X509CRLSelector selector = new X509CRLSelector();
    try {
        selector.addIssuerName("a");
        fail("IOException expected");
    } catch (IOException e) {}

    //no exception for null
    selector.addIssuerName((String) null);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:15,代码来源:X509CRLSelectorTest.java

示例6: perform

import java.security.cert.X509CRLSelector; //导入方法依赖的package包/类
public TestResult perform()
{
    try
     {
     CertificateFactory cf = CertificateFactory.getInstance("X.509", "BC");

     X509Certificate rootCert = (X509Certificate)cf.generateCertificate(new ByteArrayInputStream(CertPathTest.rootCertBin));
     X509Certificate interCert = (X509Certificate)cf.generateCertificate(new ByteArrayInputStream(CertPathTest.interCertBin));
     X509Certificate finalCert = (X509Certificate)cf.generateCertificate(new ByteArrayInputStream(CertPathTest.finalCertBin));
     X509CRL rootCrl = (X509CRL)cf.generateCRL(new ByteArrayInputStream(CertPathTest.rootCrlBin));
     X509CRL interCrl = (X509CRL)cf.generateCRL(new ByteArrayInputStream(CertPathTest.interCrlBin));

         //Testing CollectionCertStore generation from List
     List list = new ArrayList();
     list.add( rootCert );
     list.add( interCert );
     list.add( finalCert );
     list.add( rootCrl );
     list.add( interCrl );
     CollectionCertStoreParameters ccsp = new CollectionCertStoreParameters( list );
     CertStore store = CertStore.getInstance("Collection", ccsp );

         //Searching for rootCert by subjectDN
     X509CertSelector targetConstraints = new X509CertSelector();
     targetConstraints.setSubject(rootCert.getSubjectDN().getName());
     Collection certs = store.getCertificates( targetConstraints );
     if ( certs.size() != 1 || 
          ! certs.contains( rootCert ) ) {
         return new SimpleTestResult( false,  this.getName() + ": rootCert not found by subjectDN" );
     }

         //Searching for rootCert by subjectDN encoded as byte
    targetConstraints = new X509CertSelector();
    targetConstraints.setSubject(((X509Principal)rootCert.getSubjectDN()).getEncoded());
    certs = store.getCertificates( targetConstraints );
    if ( certs.size() != 1 || 
         ! certs.contains( rootCert ) ) {
        return new SimpleTestResult( false,  this.getName() + ": rootCert not found by encoded subjectDN" );
     }

         //Searching for rootCert by public key encoded as byte
    targetConstraints = new X509CertSelector();
    targetConstraints.setSubjectPublicKey(rootCert.getPublicKey().getEncoded());
    certs = store.getCertificates( targetConstraints );
    if ( certs.size() != 1 || 
         ! certs.contains( rootCert ) ) {
        return new SimpleTestResult( false,  this.getName() + ": rootCert not found by encoded public key" );
     }

         //Searching for interCert by issuerDN
     targetConstraints = new X509CertSelector();
     targetConstraints.setIssuer( ((X509Principal)rootCert.getSubjectDN()).getEncoded() );
     certs = store.getCertificates( targetConstraints );
     if ( certs.size() != 2 ) {
         return new SimpleTestResult( false,  this.getName() + ": did not found 2 certs" );
     }
     if ( ! certs.contains( rootCert ) ) {
         return new SimpleTestResult( false,  this.getName() + ": rootCert not found" );
     }
     if ( ! certs.contains( interCert ) ) {
         return new SimpleTestResult( false,  this.getName() + ": interCert not found" );
     }

         //Searching for rootCrl by issuerDN
     X509CRLSelector targetConstraintsCRL = new X509CRLSelector();
     targetConstraintsCRL.addIssuerName( ((X509Principal)rootCrl.getIssuerDN()).getEncoded() );
     Collection crls = store.getCRLs( targetConstraintsCRL );
     if ( crls.size() != 1 || 
          ! crls.contains( rootCrl ) ) {
         return new SimpleTestResult( false,  this.getName() + ": rootCrl not found" );
     }
     }
    catch (Exception e)
     {
     e.printStackTrace();
     return new SimpleTestResult(false, this.getName() + ": exception - " + e.toString());
     }

    return new SimpleTestResult(true, this.getName() + ": Okay");
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:81,代码来源:CertStoreTest.java


注:本文中的java.security.cert.X509CRLSelector.addIssuerName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。