Examples of XKMSCacheToken


Examples of org.apache.cxf.xkms.cache.XKMSCacheToken

        throws WSSecurityException {
        if (certs != null) {
            LOG.fine(String.format("Verifying certificate id: %s", certs[0].getSubjectDN()));
        }
       
        XKMSCacheToken cachedToken = null;
        // Try local cache first
        if (certs != null && certs.length > 0 && xkmsClientCache != null) {
            String key = certs[0].getSubjectX500Principal().getName();
            // Try by Subject DN and IssuerSerial
            cachedToken = xkmsClientCache.get(key);
            if (cachedToken == null) {
                key = getKeyForIssuerSerial(certs[0].getIssuerX500Principal().getName(),
                                            certs[0].getSerialNumber());
                cachedToken = xkmsClientCache.get(key);
            }
            if (cachedToken != null && cachedToken.isXkmsValidated()) {
                LOG.fine("Certificate has already been validated by the XKMS service");
                return true;
            }
        }
        if (certs == null || certs[0] == null || !xkmsInvoker.validateCertificate(certs[0])) {
            throw new CryptoProviderException("The given certificate is not valid");
        }
       
        // Validate Cached token
        if (cachedToken != null) {
            cachedToken.setXkmsValidated(true);
        }
       
        // Otherwise, Store in the cache as a validated certificate
        storeCertificateInCache(certs[0], null, true);
       
View Full Code Here

Examples of org.apache.cxf.xkms.cache.XKMSCacheToken

            throw new IllegalArgumentException("Id is not specified for certificate request");
        }
       
        // Try local cache first
        if (xkmsClientCache != null) {
            XKMSCacheToken cachedToken = xkmsClientCache.get(id.toLowerCase());
            if (cachedToken != null && cachedToken.getX509Certificate() != null) {
                return new X509Certificate[] {cachedToken.getX509Certificate()};
            }
        }
       
        // Now ask the XKMS Service
        X509Certificate cert = xkmsInvoker.getCertificateForId(application, id);
View Full Code Here

Examples of org.apache.cxf.xkms.cache.XKMSCacheToken

                               issuer, serial));
       
        String key = getKeyForIssuerSerial(issuer, serial);
        // Try local cache first
        if (xkmsClientCache != null) {
            XKMSCacheToken cachedToken = xkmsClientCache.get(key);
            if (cachedToken != null && cachedToken.getX509Certificate() != null) {
                return new X509Certificate[] {cachedToken.getX509Certificate()};
            }
        }
        // Now ask the XKMS Service
        X509Certificate certificate = xkmsInvoker.getCertificateForIssuerSerial(issuer, serial);
       
View Full Code Here

Examples of org.apache.cxf.xkms.cache.XKMSCacheToken

    }
   
    private void storeCertificateInCache(X509Certificate certificate, String key, boolean validated) {
        // Store in the cache
        if (certificate != null && xkmsClientCache != null) {
            XKMSCacheToken cacheToken = new XKMSCacheToken(certificate);
            cacheToken.setXkmsValidated(validated);
            // Store using a custom key (if any)
            if (key != null) {
                xkmsClientCache.put(key, cacheToken);
            }
            // Store it using IssuerSerial as well
View Full Code Here

Examples of org.apache.cxf.xkms.cache.XKMSCacheToken

    ) throws WSSecurityException {
        if (certs != null) {
            LOG.fine(String.format("Verifying certificate id: %s", certs[0].getSubjectDN()));
        }
       
        XKMSCacheToken cachedToken = null;
        // Try local cache first
        if (certs != null && certs.length > 0 && xkmsClientCache != null) {
            String key = certs[0].getSubjectX500Principal().getName();
            // Try by Subject DN and IssuerSerial
            cachedToken = xkmsClientCache.get(key);
            if (cachedToken == null) {
                key = getKeyForIssuerSerial(certs[0].getIssuerX500Principal().getName(),
                                            certs[0].getSerialNumber());
                cachedToken = xkmsClientCache.get(key);
            }
            if (cachedToken != null && cachedToken.isXkmsValidated()) {
                LOG.fine("Certificate has already been validated by the XKMS service");
                return;
            }
        }
        if (certs == null || certs[0] == null || !xkmsInvoker.validateCertificate(certs[0])) {
            throw new CryptoProviderException("The given certificate is not valid");
        }
       
        // Validate Cached token
        if (cachedToken != null) {
            cachedToken.setXkmsValidated(true);
        }
       
        // Otherwise, Store in the cache as a validated certificate
        storeCertificateInCache(certs[0], null, true);
    }
View Full Code Here

Examples of org.apache.cxf.xkms.cache.XKMSCacheToken

    private X509Certificate[] checkX509Cache(String key) {
        if (xkmsClientCache == null) {
            return null;
        }
       
        XKMSCacheToken cachedToken = xkmsClientCache.get(key);
        if (cachedToken != null && cachedToken.getX509Certificate() != null) {
            return new X509Certificate[] {
                cachedToken.getX509Certificate()
            };
        } else {
            return null;
        }
    }
View Full Code Here

Examples of org.apache.cxf.xkms.cache.XKMSCacheToken

    }
   
    private void storeCertificateInCache(X509Certificate certificate, String key, boolean validated) {
        // Store in the cache
        if (certificate != null && xkmsClientCache != null) {
            XKMSCacheToken cacheToken = new XKMSCacheToken(certificate);
            cacheToken.setXkmsValidated(validated);
            // Store using a custom key (if any)
            if (key != null) {
                xkmsClientCache.put(key, cacheToken);
            }
            // Store it using IssuerSerial as well
View Full Code Here

Examples of org.apache.cxf.xkms.cache.XKMSCacheToken

        throws WSSecurityException {
        if (certs != null) {
            LOG.fine(String.format("Verifying certificate id: %s", certs[0].getSubjectDN()));
        }
       
        XKMSCacheToken cachedToken = null;
        // Try local cache first
        if (certs != null && certs.length > 0 && xkmsClientCache != null) {
            String key = certs[0].getSubjectX500Principal().getName();
            // Try by Subject DN and IssuerSerial
            cachedToken = xkmsClientCache.get(key);
            if (cachedToken == null) {
                key = getKeyForIssuerSerial(certs[0].getIssuerX500Principal().getName(),
                                            certs[0].getSerialNumber());
                cachedToken = xkmsClientCache.get(key);
            }
            if (cachedToken != null && cachedToken.isXkmsValidated()) {
                LOG.fine("Certificate has already been validated by the XKMS service");
                return;
            }
        }
        if (certs == null || certs[0] == null || !xkmsInvoker.validateCertificate(certs[0])) {
            throw new CryptoProviderException("The given certificate is not valid");
        }
       
        // Validate Cached token
        if (cachedToken != null) {
            cachedToken.setXkmsValidated(true);
        }
       
        // Otherwise, Store in the cache as a validated certificate
        storeCertificateInCache(certs[0], null, true);
    }
View Full Code Here

Examples of org.apache.cxf.xkms.cache.XKMSCacheToken

    private X509Certificate[] checkX509Cache(String key) {
        if (xkmsClientCache == null) {
            return null;
        }
       
        XKMSCacheToken cachedToken = xkmsClientCache.get(key);
        if (cachedToken != null && cachedToken.getX509Certificate() != null) {
            return new X509Certificate[] {
                cachedToken.getX509Certificate()
            };
        } else {
            return null;
        }
    }
View Full Code Here

Examples of org.apache.cxf.xkms.cache.XKMSCacheToken

    }
   
    private void storeCertificateInCache(X509Certificate certificate, String key, boolean validated) {
        // Store in the cache
        if (certificate != null && xkmsClientCache != null) {
            XKMSCacheToken cacheToken = new XKMSCacheToken(certificate);
            cacheToken.setXkmsValidated(validated);
            // Store using a custom key (if any)
            if (key != null) {
                xkmsClientCache.put(key, cacheToken);
            }
            // Store it using IssuerSerial as well
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.