![]() |
The Java Developers Almanac 1.4 |
|
e229. Creating a Certification PathThis example demonstrates how to create aCertPath object from
an list of certificates.
// The CA's certificate should be the last element in the array
public static CertPath createCertPath(java.security.cert.Certificate[] certs) {
try {
CertificateFactory certFact = CertificateFactory.getInstance("X.509");
CertPath path = certFact.generateCertPath(Arrays.asList(certs));
return path;
} catch (java.security.cert.CertificateEncodingException e) {
} catch (CertificateException e) {
}
return null;
}
e230. Listing the Most-Trusted Certificate Authorities (CA) in a Key Store e231. Validating a Certification Path
© 2002 Addison-Wesley. |