Code example for KeyStore

Methods: getCertificate

0
    } 
 
    /** {@inheritDoc} */ 
    public X509Certificate getEntityCertificate() {
        try { 
            return (X509Certificate) keyStore.getCertificate(credentialAlias);
        } catch (KeyStoreException e) {
            log.error("Error accessing {} certificates in keystore", e);
            return null; 
        } 
    } 
 
    /** {@inheritDoc} */ 
    public Collection<X509Certificate> getEntityCertificateChain() {
        List<X509Certificate> certsCollection = Collections.EMPTY_LIST;
 
        try { 
            Certificate[] certs = keyStore.getCertificateChain(credentialAlias);
            if (certs != null) {
                certsCollection = new ArrayList<X509Certificate>(certs.length);
                for (Certificate cert : certs) {