The Java Developers Almanac 1.4


Order this book from Amazon.

   
Home > List of Packages > java.security.cert  [9 examples] > Certification Paths  [4 examples]

e229. Creating a Certification Path

This example demonstrates how to create a CertPath 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;
    }

 Related Examples
e228. Listing All Available Certification Path Validation Algorithms
e230. Listing the Most-Trusted Certificate Authorities (CA) in a Key Store
e231. Validating a Certification Path

See also: Certificates   


© 2002 Addison-Wesley.