Example usage for org.bouncycastle.i18n ErrorBundle getDetail

List of usage examples for org.bouncycastle.i18n ErrorBundle getDetail

Introduction

In this page you can find the example usage for org.bouncycastle.i18n ErrorBundle getDetail.

Prototype

public String getDetail(Locale loc) throws MissingEntryException 

Source Link

Document

Returns the detail message in the given locale and the default timezone.

Usage

From source file:gov.nih.nci.cacis.nav.ValidateSignedMail.java

License:BSD License

private boolean handleValidateResults(SignedMailValidator.ValidationResult result) {
    boolean valid = true;
    if (result.isValidSignature()) {
        final ErrorBundle errMsg = getErrorBundle("SignedMailValidator.sigValid");
        LOG.warn(errMsg.getText(loc));//from   ww w .ja va2s .co m
    } else {
        valid = false;
        final ErrorBundle errMsg = getErrorBundle("SignedMailValidator.sigInvalid");
        LOG.warn(errMsg.getText(loc));
        // print errors
        LOG.warn("Errors:");
        final Iterator errorsIt = result.getErrors().iterator();
        while (errorsIt.hasNext()) {
            final ErrorBundle errorMsg = (ErrorBundle) errorsIt.next();
            if (dbgLvl == DETAIL) {
                LOG.warn(DBL_TAB + errorMsg.getDetail(loc));
            } else {
                LOG.warn(DBL_TAB + errorMsg.getText(loc));
            }
        }
    }
    return valid;
}

From source file:gov.nih.nci.cacis.nav.ValidateSignedMail.java

License:BSD License

private void handleNotifications(SignedMailValidator.ValidationResult result) {
    if (!result.getNotifications().isEmpty()) {
        LOG.warn("Notifications:");
        final Iterator notIt = result.getNotifications().iterator();
        while (notIt.hasNext()) {
            final ErrorBundle notMsg = (ErrorBundle) notIt.next();
            if (dbgLvl == DETAIL) {
                LOG.warn(DBL_TAB + notMsg.getDetail(loc));
            } else {
                LOG.warn(DBL_TAB + notMsg.getText(loc));
            }/*from  w  w  w.  j a  v a2  s . c o  m*/
        }
    }
}

From source file:gov.nih.nci.cacis.nav.ValidateSignedMail.java

License:BSD License

private boolean handleCertPathValidation(PKIXCertPathReviewer review) {
    boolean valid = true;

    if (review.isValidCertPath()) {
        LOG.warn("Certificate path valid");
    } else {/* w  w  w . j a va2 s  . com*/
        LOG.warn("Certificate path invalid");
        valid = false;
    }

    LOG.warn("\nCertificate path validation results:");
    // global errors
    LOG.warn("Errors:");
    final Iterator errorsIt = review.getErrors(-1).iterator();
    while (errorsIt.hasNext()) {
        final ErrorBundle errorMsg = (ErrorBundle) errorsIt.next();
        if (dbgLvl == DETAIL) {
            LOG.warn(DBL_TAB + errorMsg.getDetail(loc));
        } else {
            LOG.warn(DBL_TAB + errorMsg.getText(loc));
        }
    }

    return valid;
}

From source file:gov.nih.nci.cacis.nav.ValidateSignedMail.java

License:BSD License

private void handleCertificateErrorsAndNotifications(PKIXCertPathReviewer review) {
    // per certificate errors and notifications
    final Iterator certIt = review.getCertPath().getCertificates().iterator();
    int i = 0;/*from  www .j  a  v  a 2 s  . c  o m*/
    while (certIt.hasNext()) {
        final X509Certificate cert = (X509Certificate) certIt.next();
        LOG.warn("\nCertificate " + i + "\n========");
        LOG.warn("Issuer: " + cert.getIssuerDN().getName());
        LOG.warn("Subject: " + cert.getSubjectDN().getName());

        // errors
        LOG.warn("\tErrors:");
        final Iterator errorsIt = review.getErrors(i).iterator();
        while (errorsIt.hasNext()) {
            final ErrorBundle errorMsg = (ErrorBundle) errorsIt.next();
            if (dbgLvl == DETAIL) {
                LOG.warn(DBL_TAB + errorMsg.getDetail(loc));
            } else {
                LOG.warn(DBL_TAB + errorMsg.getText(loc));
            }
        }

        // notifications
        LOG.warn("\tNotifications:");
        final Iterator notificationsIt = review.getNotifications(i).iterator();
        while (notificationsIt.hasNext()) {
            final ErrorBundle noteMsg = (ErrorBundle) notificationsIt.next();
            if (dbgLvl == DETAIL) {
                LOG.warn(DBL_TAB + noteMsg.getDetail(loc));
            } else {
                LOG.warn(DBL_TAB + noteMsg.getText(loc));
            }
        }

        i++;
    }
}