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


Java X509CertPathImpl类代码示例

本文整理汇总了Java中org.apache.harmony.security.provider.cert.X509CertPathImpl的典型用法代码示例。如果您正苦于以下问题:Java X509CertPathImpl类的具体用法?Java X509CertPathImpl怎么用?Java X509CertPathImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: testTrustAndRemoteCertificatesWithDifferentEncodings

import org.apache.harmony.security.provider.cert.X509CertPathImpl; //导入依赖的package包/类
public void testTrustAndRemoteCertificatesWithDifferentEncodings()
        throws IOException, CertificateException, KeyStoreException,
        InvalidAlgorithmParameterException, CertPathValidatorException {

    X509CertPathImpl certPath = new X509CertPathImpl(Arrays.asList(
            new X509CertImpl(serviceSprintComCertChain[0]),
            new X509CertImpl(serviceSprintComCertChain[1]),
            new X509CertImpl(serviceSprintComCertChain[2])));

    Set<TrustAnchor> trustAnchors = new HashSet<TrustAnchor>();
    trustAnchors.add(new TrustAnchor(new X509CertificateObject(
            new X509CertificateStructure(
                    (ASN1Sequence) new ASN1InputStream(trustedCert).readObject())), null));

    IndexedPKIXParameters indexedPKIXParameters = new IndexedPKIXParameters(trustAnchors);
    indexedPKIXParameters.setRevocationEnabled(false);

    new PKIXCertPathValidatorSpi().engineValidate(certPath, indexedPKIXParameters);
    // completing normally indicates that the certificate was valid
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:21,代码来源:PKIXCertPathValidatorSpiTest.java

示例2: ByteArrayInputStream

import org.apache.harmony.security.provider.cert.X509CertPathImpl; //导入依赖的package包/类
/**
 * @tests org.apache.harmony.security.provider.cert.X509CertPathImpl.getInstance(byte[], String)
 */
public void test_getInstance$BLjava_lang_String() throws Exception {

    // Test: getInstance(byte[] in, "PKCS7")
    // reconverting of the encoded form: from default (PkiPath) to PKCS7
    byte[] encoding = certPath.getEncoded();

    CertificateFactory factory = CertificateFactory.getInstance("X.509");

    ByteArrayInputStream bais = new ByteArrayInputStream(encoding);

    CertPath cert_path = factory.generateCertPath(bais);

    encoding = cert_path.getEncoded("PKCS7");

    X509CertPathImpl cpath = X509CertPathImpl
            .getInstance(encoding, "PKCS7");
    assertEquals("Certificate list size missmatch", certList.size(), cpath
            .getCertificates().size());

    bais = new ByteArrayInputStream(encoding);

    cpath = X509CertPathImpl.getInstance(bais, "PKCS7");
    assertEquals("Certificate list size missmatch", certList.size(), cpath
            .getCertificates().size());
}
 
开发者ID:shannah,项目名称:cn1,代码行数:29,代码来源:X509CertPathImplTest.java

示例3: setUp

import org.apache.harmony.security.provider.cert.X509CertPathImpl; //导入依赖的package包/类
protected void setUp() throws java.lang.Exception {
    certList = new ArrayList();
    for (int i=0; i<2; i++) {
        certList.add(certificate);
    }
    certPath = new X509CertPathImpl(certList);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:8,代码来源:X509CertPathImplTest.java

示例4: test_getInstance_InputStream

import org.apache.harmony.security.provider.cert.X509CertPathImpl; //导入依赖的package包/类
/**
 * @tests org.apache.harmony.security.provider.cert.X509CertPathImpl.getInstance(InputStream)
 */
public void test_getInstance_InputStream() throws Exception {
    byte[] encoding = certPath.getEncoded();
    ByteArrayInputStream bais = new ByteArrayInputStream(encoding);
    X509CertPathImpl cpath = X509CertPathImpl.getInstance(bais);
    assertEquals("Certificate list size missmatch", certList.size(), cpath
            .getCertificates().size());
}
 
开发者ID:shannah,项目名称:cn1,代码行数:11,代码来源:X509CertPathImplTest.java

示例5: assertEquals

import org.apache.harmony.security.provider.cert.X509CertPathImpl; //导入依赖的package包/类
/**
 * @tests org.apache.harmony.security.provider.cert.X509CertPathImpl.getInstance(byte[])
 */
public void test_getInstance_$B() throws Exception {
    byte[] encoding = certPath.getEncoded();
    X509CertPathImpl cpath = X509CertPathImpl.getInstance(encoding);
    assertEquals("Certificate list size missmatch", certList.size(), cpath
            .getCertificates().size());
}
 
开发者ID:shannah,项目名称:cn1,代码行数:10,代码来源:X509CertPathImplTest.java

示例6: test_getCertificates

import org.apache.harmony.security.provider.cert.X509CertPathImpl; //导入依赖的package包/类
/**
 * @tests org.apache.harmony.security.provider.cert.X509CertPathImpl.getCertificates()
 */
public void test_getCertificates() throws Exception {
    try {
        byte[] encoding = certPath.getEncoded();
        X509CertPathImpl cpath = X509CertPathImpl.getInstance(encoding);
        assertEquals("Certificate list size missmatch", certList.size(),
                cpath.getCertificates().size());
        cpath.getCertificates().remove(0);
        fail("UnsupportedOperationException should be thrown");
    } catch (UnsupportedOperationException e) {
        //pass
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:16,代码来源:X509CertPathImplTest.java


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