Code example for CertPath

Methods: getCertificates

0
//        JOptionPane.showMessageDialog(null, "Chứng thư số không hợp pháp"); 
    } 
 
    private CertPath removeLastCertFromCertChain(CertPath aCertChain)
            throws CertificateException { 
        List certs = aCertChain.getCertificates();
        int certsCount = certs.size();
        List certsWithoutLast = certs.subList(0, certsCount - 1);
        CertificateFactory cf = CertificateFactory.getInstance("X.509");
        CertPath certChainWithoutLastCert = cf.generateCertPath(certsWithoutLast);
        return certChainWithoutLastCert;
    } 
 
    public static CertPath loadCertPathFromBase64String(String aCertChainBase64Encoded) throws CertificateException, IOException {
        byte[] certChainEncoded = Base64Utils.base64Decode(aCertChainBase64Encoded);
        CertificateFactory cf = CertificateFactory.getInstance("X.509");
        InputStream certChainStream = new ByteArrayInputStream(certChainEncoded);
        CertPath certPath;
        try { 
            certPath = cf.generateCertPath(certChainStream, "PkiPath");
        } finally {