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


Java X509CertPathImpl.getInstance方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

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