summaryrefslogtreecommitdiffstats
path: root/pki/base/common/src/com/netscape/cms/profile/constraint/CAValidityConstraint.java
diff options
context:
space:
mode:
Diffstat (limited to 'pki/base/common/src/com/netscape/cms/profile/constraint/CAValidityConstraint.java')
-rw-r--r--pki/base/common/src/com/netscape/cms/profile/constraint/CAValidityConstraint.java54
1 files changed, 23 insertions, 31 deletions
diff --git a/pki/base/common/src/com/netscape/cms/profile/constraint/CAValidityConstraint.java b/pki/base/common/src/com/netscape/cms/profile/constraint/CAValidityConstraint.java
index 4d89e739..17c6c34f 100644
--- a/pki/base/common/src/com/netscape/cms/profile/constraint/CAValidityConstraint.java
+++ b/pki/base/common/src/com/netscape/cms/profile/constraint/CAValidityConstraint.java
@@ -17,7 +17,6 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cms.profile.constraint;
-
import java.io.IOException;
import java.util.Date;
import java.util.Locale;
@@ -38,12 +37,10 @@ import com.netscape.cms.profile.def.NoDefault;
import com.netscape.cms.profile.def.UserValidityDefault;
import com.netscape.cms.profile.def.ValidityDefault;
-
/**
- * This class implements the validity constraint.
- * It checks if the validity in the certificate
- * template is within the CA's validity.
- *
+ * This class implements the validity constraint. It checks if the validity in
+ * the certificate template is within the CA's validity.
+ *
* @version $Revision$, $Date$
*/
public class CAValidityConstraint extends CAEnrollConstraint {
@@ -56,7 +53,7 @@ public class CAValidityConstraint extends CAEnrollConstraint {
}
public void init(IProfile profile, IConfigStore config)
- throws EProfileException {
+ throws EProfileException {
super.init(profile, config);
X509CertImpl caCert = getCACert();
@@ -65,19 +62,18 @@ public class CAValidityConstraint extends CAEnrollConstraint {
}
/**
- * Validates the request. The request is not modified
- * during the validation.
+ * Validates the request. The request is not modified during the validation.
*/
public void validate(IRequest request, X509CertInfo info)
- throws ERejectException {
+ throws ERejectException {
CMS.debug("CAValidityConstraint: validate start");
CertificateValidity v = null;
try {
v = (CertificateValidity) info.get(X509CertInfo.VALIDITY);
} catch (Exception e) {
- throw new ERejectException(CMS.getUserMessage(
- getLocale(request), "CMS_PROFILE_VALIDITY_NOT_FOUND"));
+ throw new ERejectException(CMS.getUserMessage(getLocale(request),
+ "CMS_PROFILE_VALIDITY_NOT_FOUND"));
}
Date notBefore = null;
@@ -85,8 +81,8 @@ public class CAValidityConstraint extends CAEnrollConstraint {
notBefore = (Date) v.get(CertificateValidity.NOT_BEFORE);
} catch (IOException e) {
CMS.debug("CAValidity: not before " + e.toString());
- throw new ERejectException(CMS.getUserMessage(
- getLocale(request), "CMS_PROFILE_INVALID_NOT_BEFORE"));
+ throw new ERejectException(CMS.getUserMessage(getLocale(request),
+ "CMS_PROFILE_INVALID_NOT_BEFORE"));
}
Date notAfter = null;
@@ -94,37 +90,33 @@ public class CAValidityConstraint extends CAEnrollConstraint {
notAfter = (Date) v.get(CertificateValidity.NOT_AFTER);
} catch (IOException e) {
CMS.debug("CAValidity: not after " + e.toString());
- throw new ERejectException(CMS.getUserMessage(
- getLocale(request), "CMS_PROFILE_INVALID_NOT_AFTER"));
+ throw new ERejectException(CMS.getUserMessage(getLocale(request),
+ "CMS_PROFILE_INVALID_NOT_AFTER"));
}
if (mDefNotBefore != null) {
- CMS.debug("ValidtyConstraint: notBefore=" + notBefore +
- " defNotBefore=" + mDefNotBefore);
+ CMS.debug("ValidtyConstraint: notBefore=" + notBefore
+ + " defNotBefore=" + mDefNotBefore);
if (notBefore.before(mDefNotBefore)) {
throw new ERejectException(CMS.getUserMessage(
- getLocale(request), "CMS_PROFILE_INVALID_NOT_BEFORE"));
+ getLocale(request), "CMS_PROFILE_INVALID_NOT_BEFORE"));
}
}
- CMS.debug("ValidtyConstraint: notAfter=" + notAfter +
- " defNotAfter=" + mDefNotAfter);
+ CMS.debug("ValidtyConstraint: notAfter=" + notAfter + " defNotAfter="
+ + mDefNotAfter);
if (notAfter.after(mDefNotAfter)) {
- throw new ERejectException(CMS.getUserMessage(
- getLocale(request), "CMS_PROFILE_INVALID_NOT_AFTER"));
+ throw new ERejectException(CMS.getUserMessage(getLocale(request),
+ "CMS_PROFILE_INVALID_NOT_AFTER"));
}
CMS.debug("CAValidtyConstraint: validate end");
}
public String getText(Locale locale) {
- String params[] = {
- mDefNotBefore.toString(),
- mDefNotAfter.toString()
- };
-
- return CMS.getUserMessage(locale,
- "CMS_PROFILE_CONSTRAINT_CA_VALIDITY_CONSTRAINT_TEXT",
- params);
+ String params[] = { mDefNotBefore.toString(), mDefNotAfter.toString() };
+
+ return CMS.getUserMessage(locale,
+ "CMS_PROFILE_CONSTRAINT_CA_VALIDITY_CONSTRAINT_TEXT", params);
}
public boolean isApplicable(IPolicyDefault def) {