Code example for CertPath

Methods: getCertificates

0
        return parameters;
    } 
 
    @Override 
    void validateCertPath(CertPath path) {
        List<? extends Certificate> certificates = path.getCertificates();
        Certificate certificate = certificates.get(0);
 
        assertEquals("unexpected certificate type", "X.509", certificate
                .getType());
 
        X509Certificate x509Certificate = (X509Certificate) certificate;
        X500Principal subjectX500Principal = x509Certificate
                .getSubjectX500Principal();
 
        X500Principal expectedPrincipal = new X500Principal("CN=Android CTS, "
                + "OU=Android, O=Android, L=Android, ST=Android, C=AN"); 
 
        assertEquals("unexpected principal", expectedPrincipal,
                subjectX500Principal);
    }