Skip to Main Content

Java Security

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

certificate chain with CertificateFactory

843811May 12 2003 — edited Jul 26 2010
Hi , i want to import the cert chain gived by my CA like keytool.
I try to explain better:
When i import the file returned by my CA with keytool,
the method getCertificateChain(myalias) returns 2 certificates.
I want to make the same operation using java code:

FileInputStream fis = new FileInputStream(filename);
CertificateFactory cf = CertificateFactory.getInstance("X.509");
Collection c = cf.generateCertificates(fis);
X509Certificate certs = new x509Certificate[c.size()];
Iterator i = c.iterator();
while (i.hasNext()) {
cert[num++] = (X509Certificate)i.next();
System.out.println(cert);
}


But Why the Collection size is 1 ? (I expected 2)
After when i replace the alias certificate in the keystore ,
with the method getCertificateChain i obtain only 1 cert.
Any Ideas....
How can i import the PKCS#7-formatted certificate reply ?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 23 2010
Added on May 12 2003
5 comments
598 views