summaryrefslogtreecommitdiffstats
path: root/pki/base/common/src/com/netscape/cms/profile/constraint/ExtendedKeyUsageExtConstraint.java
diff options
context:
space:
mode:
authorAde Lee <alee@redhat.com>2011-12-08 21:15:59 -0500
committerAde Lee <alee@redhat.com>2011-12-08 21:15:59 -0500
commit171aaece4f23709d33d180cf36eb3af5e454b0c9 (patch)
tree1485f9f0a7bd10de4ff25030db575dbb8dafae74 /pki/base/common/src/com/netscape/cms/profile/constraint/ExtendedKeyUsageExtConstraint.java
parentadad2fcee8a29fdb82376fbce07dedb11fccc182 (diff)
downloadpki-171aaece4f23709d33d180cf36eb3af5e454b0c9.tar.gz
pki-171aaece4f23709d33d180cf36eb3af5e454b0c9.tar.xz
pki-171aaece4f23709d33d180cf36eb3af5e454b0c9.zip
Revert "Formatting"
This reverts commit 32150d3ee32f8ac27118af7c792794b538c78a2f.
Diffstat (limited to 'pki/base/common/src/com/netscape/cms/profile/constraint/ExtendedKeyUsageExtConstraint.java')
-rw-r--r--pki/base/common/src/com/netscape/cms/profile/constraint/ExtendedKeyUsageExtConstraint.java74
1 files changed, 45 insertions, 29 deletions
diff --git a/pki/base/common/src/com/netscape/cms/profile/constraint/ExtendedKeyUsageExtConstraint.java b/pki/base/common/src/com/netscape/cms/profile/constraint/ExtendedKeyUsageExtConstraint.java
index 88cfb542..539f4890 100644
--- a/pki/base/common/src/com/netscape/cms/profile/constraint/ExtendedKeyUsageExtConstraint.java
+++ b/pki/base/common/src/com/netscape/cms/profile/constraint/ExtendedKeyUsageExtConstraint.java
@@ -17,6 +17,7 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cms.profile.constraint;
+
import java.util.Enumeration;
import java.util.Locale;
import java.util.StringTokenizer;
@@ -39,17 +40,19 @@ import com.netscape.cms.profile.def.ExtendedKeyUsageExtDefault;
import com.netscape.cms.profile.def.NoDefault;
import com.netscape.cms.profile.def.UserExtensionDefault;
+
/**
- * This class implements the extended key usage extension constraint. It checks
- * if the extended key usage extension in the certificate template satisfies the
- * criteria.
- *
+ * This class implements the extended key usage extension constraint.
+ * It checks if the extended key usage extension in the certificate
+ * template satisfies the criteria.
+ *
* @version $Revision$, $Date$
*/
public class ExtendedKeyUsageExtConstraint extends EnrollConstraint {
public static final String CONFIG_CRITICAL = "exKeyUsageCritical";
- public static final String CONFIG_OIDS = "exKeyUsageOIDs";
+ public static final String CONFIG_OIDS =
+ "exKeyUsageOIDs";
public ExtendedKeyUsageExtConstraint() {
super();
@@ -58,33 +61,38 @@ public class ExtendedKeyUsageExtConstraint extends EnrollConstraint {
}
public void init(IProfile profile, IConfigStore config)
- throws EProfileException {
+ throws EProfileException {
super.init(profile, config);
}
- public IDescriptor getConfigDescriptor(Locale locale, String name) {
- if (name.equals(CONFIG_CRITICAL)) {
- return new Descriptor(IDescriptor.CHOICE, "true,false,-", "-",
+ public IDescriptor getConfigDescriptor(Locale locale, String name) {
+ if (name.equals(CONFIG_CRITICAL)) {
+ return new Descriptor(IDescriptor.CHOICE, "true,false,-",
+ "-",
CMS.getUserMessage(locale, "CMS_PROFILE_CRITICAL"));
} else if (name.equals(CONFIG_OIDS)) {
- return new Descriptor(IDescriptor.STRING, null, null,
+ return new Descriptor(IDescriptor.STRING, null,
+ null,
CMS.getUserMessage(locale, "CMS_PROFILE_OIDS"));
- }
+ }
return null;
}
/**
- * 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 {
- ExtendedKeyUsageExtension ext = (ExtendedKeyUsageExtension) getExtension(
- ExtendedKeyUsageExtension.OID, info);
+ throws ERejectException {
+ ExtendedKeyUsageExtension ext = (ExtendedKeyUsageExtension)
+ getExtension(ExtendedKeyUsageExtension.OID, info);
if (ext == null) {
- throw new ERejectException(CMS.getUserMessage(getLocale(request),
- "CMS_PROFILE_EXTENSION_NOT_FOUND",
- ExtendedKeyUsageExtension.OID));
+ throw new ERejectException(
+ CMS.getUserMessage(
+ getLocale(request),
+ "CMS_PROFILE_EXTENSION_NOT_FOUND",
+ ExtendedKeyUsageExtension.OID));
}
// check criticality
@@ -94,10 +102,12 @@ public class ExtendedKeyUsageExtConstraint extends EnrollConstraint {
boolean critical = getBoolean(value);
if (critical != ext.isCritical()) {
- throw new ERejectException(CMS.getUserMessage(
- getLocale(request), "CMS_PROFILE_CRITICAL_NOT_MATCHED"));
+ throw new ERejectException(
+ CMS.getUserMessage(
+ getLocale(request),
+ "CMS_PROFILE_CRITICAL_NOT_MATCHED"));
}
- }
+ }
// Build local cache of configured OIDs
Vector mCache = new Vector();
@@ -112,22 +122,28 @@ public class ExtendedKeyUsageExtConstraint extends EnrollConstraint {
// check OIDs
Enumeration e = ext.getOIDs();
- while (e.hasMoreElements()) {
+ while (e.hasMoreElements()) {
ObjectIdentifier oid = (ObjectIdentifier) e.nextElement();
if (!mCache.contains(oid.toString())) {
- throw new ERejectException(CMS.getUserMessage(
- getLocale(request), "CMS_PROFILE_OID_NOT_MATCHED",
- oid.toString()));
+ throw new ERejectException(
+ CMS.getUserMessage(
+ getLocale(request),
+ "CMS_PROFILE_OID_NOT_MATCHED",
+ oid.toString()));
}
}
}
public String getText(Locale locale) {
- String params[] = { getConfig(CONFIG_CRITICAL), getConfig(CONFIG_OIDS) };
-
- return CMS.getUserMessage(locale,
- "CMS_PROFILE_CONSTRAINT_EXTENDED_KEY_EXT_TEXT", params);
+ String params[] = {
+ getConfig(CONFIG_CRITICAL),
+ getConfig(CONFIG_OIDS)
+ };
+
+ return CMS.getUserMessage(locale,
+ "CMS_PROFILE_CONSTRAINT_EXTENDED_KEY_EXT_TEXT",
+ params);
}
public boolean isApplicable(IPolicyDefault def) {