Java examples for Security:Certificate
Creating a Certification Path
import java.security.cert.CertPath; import java.security.cert.CertificateException; import java.security.cert.CertificateFactory; import java.util.Arrays; public class Main { // The CA's certificate should be the last element in the array public static CertPath createCertPath(java.security.cert.Certificate[] certs) { try {//www. ja v a 2 s. c o m 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; } }