本文整理汇总了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());
}
示例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());
}
示例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());
}
示例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
}
}