Example usage for java.security.cert CertificateExpiredException getLocalizedMessage

List of usage examples for java.security.cert CertificateExpiredException getLocalizedMessage

Introduction

In this page you can find the example usage for java.security.cert CertificateExpiredException getLocalizedMessage.

Prototype

public String getLocalizedMessage() 

Source Link

Document

Creates a localized description of this throwable.

Usage

From source file:org.ejbca.core.protocol.cmp.authentication.EndEntityCertificateAuthenticationModule.java

private boolean isExtraCertValid() {
    X509Certificate cert = (X509Certificate) extraCert;
    try {/*from   www.j  a  va 2 s . c o  m*/
        cert.checkValidity();
        if (log.isDebugEnabled()) {
            log.debug("The certificate in extraCert is valid");
        }
    } catch (CertificateExpiredException e) {
        this.errorMessage = "The certificate attached to the PKIMessage in the extraCert field in not valid.";
        if (log.isDebugEnabled()) {
            log.debug(this.errorMessage + " SubjectDN=" + CertTools.getSubjectDN(cert) + " - "
                    + e.getLocalizedMessage());
        }
        return false;
    } catch (CertificateNotYetValidException e) {
        this.errorMessage = "The certificate attached to the PKIMessage in the extraCert field in not valid.";
        if (log.isDebugEnabled()) {
            log.debug(this.errorMessage + " SubjectDN=" + CertTools.getSubjectDN(cert) + " - "
                    + e.getLocalizedMessage());
        }
        return false;
    }
    return true;
}