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