Search in sources :

Example 1 with AMCertPath

use of com.sun.identity.security.cert.AMCertPath in project OpenAM by OpenRock.

the class Cert method doJCERevocationValidation.

private int doJCERevocationValidation(X509Certificate[] allCerts) throws AuthLoginException {
    int ret = ISAuthConstants.LOGIN_IGNORE;
    try {
        Vector crls = new Vector();
        for (X509Certificate cert : allCerts) {
            X509CRL crl = AMCRLStore.getCRL(ldapParam, cert, amAuthCert_chkAttributesCRL);
            if (crl != null) {
                crls.add(crl);
            }
        }
        if (debug.messageEnabled()) {
            debug.message("Cert.doRevocationValidation: crls size = " + crls.size());
            if (crls.size() > 0) {
                debug.message("CRL = " + crls.toString());
            }
        }
        AMCertPath certpath = new AMCertPath(crls);
        if (!certpath.verify(allCerts, crlEnabled, ocspEnabled)) {
            debug.error("CertPath:verify failed.");
            return ret;
        } else {
            if (debug.messageEnabled()) {
                debug.message("CertPath:verify success.");
            }
        }
        ret = ISAuthConstants.LOGIN_SUCCEED;
    } catch (Exception e) {
        debug.error("Cert.doRevocationValidation: verify failed.", e);
    }
    return ret;
}
Also used : X509CRL(java.security.cert.X509CRL) AMCertPath(com.sun.identity.security.cert.AMCertPath) Vector(java.util.Vector) X509Certificate(java.security.cert.X509Certificate) UnsupportedCallbackException(javax.security.auth.callback.UnsupportedCallbackException) AuthLoginException(com.sun.identity.authentication.spi.AuthLoginException)

Aggregations

AuthLoginException (com.sun.identity.authentication.spi.AuthLoginException)1 AMCertPath (com.sun.identity.security.cert.AMCertPath)1 X509CRL (java.security.cert.X509CRL)1 X509Certificate (java.security.cert.X509Certificate)1 Vector (java.util.Vector)1 UnsupportedCallbackException (javax.security.auth.callback.UnsupportedCallbackException)1