summaryrefslogtreecommitdiffstats
path: root/pki/base/common/src/com/netscape/cms/crl/CMSIssuingDistributionPointExtension.java
diff options
context:
space:
mode:
Diffstat (limited to 'pki/base/common/src/com/netscape/cms/crl/CMSIssuingDistributionPointExtension.java')
-rw-r--r--pki/base/common/src/com/netscape/cms/crl/CMSIssuingDistributionPointExtension.java182
1 files changed, 103 insertions, 79 deletions
diff --git a/pki/base/common/src/com/netscape/cms/crl/CMSIssuingDistributionPointExtension.java b/pki/base/common/src/com/netscape/cms/crl/CMSIssuingDistributionPointExtension.java
index ccc5b64d..4109e10f 100644
--- a/pki/base/common/src/com/netscape/cms/crl/CMSIssuingDistributionPointExtension.java
+++ b/pki/base/common/src/com/netscape/cms/crl/CMSIssuingDistributionPointExtension.java
@@ -17,7 +17,6 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cms.crl;
-
import java.io.IOException;
import java.util.Locale;
import java.util.StringTokenizer;
@@ -43,14 +42,13 @@ import com.netscape.certsrv.ca.ICRLIssuingPoint;
import com.netscape.certsrv.common.NameValuePairs;
import com.netscape.certsrv.logging.ILogger;
-
/**
* This represents a issuing distribution point extension.
- *
+ *
* @version $Revision$, $Date$
*/
-public class CMSIssuingDistributionPointExtension
- implements ICMSCRLExtension, IExtendedPluginInfo {
+public class CMSIssuingDistributionPointExtension implements ICMSCRLExtension,
+ IExtendedPluginInfo {
public static final String PROP_POINTTYPE = "pointType";
public static final String PROP_POINTNAME = "pointName";
public static final String PROP_DIRNAME = "DirectoryName";
@@ -61,33 +59,25 @@ public class CMSIssuingDistributionPointExtension
public static final String PROP_INDIRECT = "indirectCRL";
public static final String PROP_REASONS = "onlySomeReasons";
- private static final String[] reasonFlags = {"unused",
- "keyCompromise",
- "cACompromise",
- "affiliationChanged",
- "superseded",
- "cessationOfOperation",
- "certificateHold",
- "privilegeWithdrawn"};
+ private static final String[] reasonFlags = { "unused", "keyCompromise",
+ "cACompromise", "affiliationChanged", "superseded",
+ "cessationOfOperation", "certificateHold", "privilegeWithdrawn" };
private ILogger mLogger = CMS.getLogger();
public CMSIssuingDistributionPointExtension() {
}
- public Extension setCRLExtensionCriticality(Extension ext,
- boolean critical) {
- IssuingDistributionPointExtension issuingDPointExt =
- (IssuingDistributionPointExtension) ext;
+ public Extension setCRLExtensionCriticality(Extension ext, boolean critical) {
+ IssuingDistributionPointExtension issuingDPointExt = (IssuingDistributionPointExtension) ext;
issuingDPointExt.setCritical(critical);
return issuingDPointExt;
}
- public Extension getCRLExtension(IConfigStore config,
- Object ip,
- boolean critical) {
+ public Extension getCRLExtension(IConfigStore config, Object ip,
+ boolean critical) {
CMS.debug("in CMSIssuingDistributionPointExtension::getCRLExtension.");
ICRLIssuingPoint crlIssuingPoint = (ICRLIssuingPoint) ip;
@@ -102,9 +92,13 @@ public class CMSIssuingDistributionPointExtension
try {
pointType = config.getString(PROP_POINTTYPE);
} catch (EPropertyNotFound e) {
- log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CREATE_DIST_POINT_UNDEFINED", e.toString()));
+ log(ILogger.LL_FAILURE,
+ CMS.getLogMessage("CRL_CREATE_DIST_POINT_UNDEFINED",
+ e.toString()));
} catch (EBaseException e) {
- log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CREATE_DIST_POINT_INVALID", e.toString()));
+ log(ILogger.LL_FAILURE,
+ CMS.getLogMessage("CRL_CREATE_DIST_POINT_INVALID",
+ e.toString()));
}
if (pointType != null) {
@@ -113,9 +107,13 @@ public class CMSIssuingDistributionPointExtension
try {
pointName = config.getString(PROP_POINTNAME);
} catch (EPropertyNotFound e) {
- log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CREATE_DIST_POINT_UNDEFINED", e.toString()));
+ log(ILogger.LL_FAILURE,
+ CMS.getLogMessage("CRL_CREATE_DIST_POINT_UNDEFINED",
+ e.toString()));
} catch (EBaseException e) {
- log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CREATE_DIST_POINT_INVALID", e.toString()));
+ log(ILogger.LL_FAILURE,
+ CMS.getLogMessage("CRL_CREATE_DIST_POINT_INVALID",
+ e.toString()));
}
if (pointName != null && pointName.length() > 0) {
@@ -123,7 +121,9 @@ public class CMSIssuingDistributionPointExtension
try {
rdnName = new RDN(pointName);
} catch (IOException e) {
- log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CREATE_RDN", e.toString()));
+ log(ILogger.LL_FAILURE,
+ CMS.getLogMessage("CRL_CREATE_RDN",
+ e.toString()));
}
} else if (pointType.equalsIgnoreCase(PROP_DIRNAME)) {
try {
@@ -131,14 +131,16 @@ public class CMSIssuingDistributionPointExtension
names.addElement(dirName);
} catch (IOException e) {
- log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CREATE_INVALID_500NAME", e.toString()));
+ log(ILogger.LL_FAILURE, CMS.getLogMessage(
+ "CRL_CREATE_INVALID_500NAME", e.toString()));
}
} else if (pointType.equalsIgnoreCase(PROP_URINAME)) {
URIName uriName = new URIName(pointName);
names.addElement(uriName);
} else {
- log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_INVALID_POTINT_TYPE", pointType));
+ log(ILogger.LL_FAILURE, CMS.getLogMessage(
+ "CRL_INVALID_POTINT_TYPE", pointType));
}
}
}
@@ -149,9 +151,11 @@ public class CMSIssuingDistributionPointExtension
try {
issuingDPoint.setFullName(names);
} catch (IOException e) {
- log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CANNOT_SET_NAME", e.toString()));
+ log(ILogger.LL_FAILURE,
+ CMS.getLogMessage("CRL_CANNOT_SET_NAME", e.toString()));
} catch (GeneralNamesException e) {
- log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CANNOT_SET_NAME", e.toString()));
+ log(ILogger.LL_FAILURE,
+ CMS.getLogMessage("CRL_CANNOT_SET_NAME", e.toString()));
}
}
@@ -160,11 +164,13 @@ public class CMSIssuingDistributionPointExtension
try {
reasons = config.getString(PROP_REASONS, null);
} catch (EBaseException e) {
- log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_INVALID_PROPERTY", PROP_REASONS, e.toString()));
+ log(ILogger.LL_FAILURE,
+ CMS.getLogMessage("CRL_INVALID_PROPERTY", PROP_REASONS,
+ e.toString()));
}
if (reasons != null && reasons.length() > 0) {
- boolean[] bits = {false, false, false, false, false, false, false};
+ boolean[] bits = { false, false, false, false, false, false, false };
int k = 0;
StringTokenizer st = new StringTokenizer(reasons, ",");
@@ -193,7 +199,9 @@ public class CMSIssuingDistributionPointExtension
if (caCertsOnly)
issuingDPoint.setOnlyContainsCACerts(caCertsOnly);
} catch (EBaseException e) {
- log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_INVALID_PROPERTY", "caCertsOnly", e.toString()));
+ log(ILogger.LL_FAILURE,
+ CMS.getLogMessage("CRL_INVALID_PROPERTY", "caCertsOnly",
+ e.toString()));
}
try {
boolean userCertsOnly = config.getBoolean(PROP_USERCERTS, false);
@@ -201,7 +209,8 @@ public class CMSIssuingDistributionPointExtension
if (userCertsOnly)
issuingDPoint.setOnlyContainsUserCerts(userCertsOnly);
} catch (EBaseException e) {
- log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_INVALID_PROPERTY", "userCertsOnly", e.toString()));
+ log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_INVALID_PROPERTY",
+ "userCertsOnly", e.toString()));
}
try {
boolean indirectCRL = config.getBoolean(PROP_INDIRECT, false);
@@ -209,7 +218,9 @@ public class CMSIssuingDistributionPointExtension
if (indirectCRL)
issuingDPoint.setIndirectCRL(indirectCRL);
} catch (EBaseException e) {
- log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_INVALID_PROPERTY", "indirectCRL", e.toString()));
+ log(ILogger.LL_FAILURE,
+ CMS.getLogMessage("CRL_INVALID_PROPERTY", "indirectCRL",
+ e.toString()));
}
issuingDPointExt = new IssuingDistributionPointExtension(issuingDPoint);
@@ -228,9 +239,13 @@ public class CMSIssuingDistributionPointExtension
try {
pointType = config.getString(PROP_POINTTYPE);
} catch (EPropertyNotFound e) {
- log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CREATE_DIST_POINT_UNDEFINED", e.toString()));
+ log(ILogger.LL_FAILURE,
+ CMS.getLogMessage("CRL_CREATE_DIST_POINT_UNDEFINED",
+ e.toString()));
} catch (EBaseException e) {
- log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CREATE_DIST_POINT_INVALID", e.toString()));
+ log(ILogger.LL_FAILURE,
+ CMS.getLogMessage("CRL_CREATE_DIST_POINT_INVALID",
+ e.toString()));
}
if (pointType != null && pointType.length() > 0) {
nvp.add("pointType", pointType);
@@ -243,9 +258,13 @@ public class CMSIssuingDistributionPointExtension
try {
pointName = config.getString(PROP_POINTNAME);
} catch (EPropertyNotFound e) {
- log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CREATE_DIST_POINT_UNDEFINED", e.toString()));
+ log(ILogger.LL_FAILURE,
+ CMS.getLogMessage("CRL_CREATE_DIST_POINT_UNDEFINED",
+ e.toString()));
} catch (EBaseException e) {
- log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_CREATE_DIST_POINT_INVALID", e.toString()));
+ log(ILogger.LL_FAILURE,
+ CMS.getLogMessage("CRL_CREATE_DIST_POINT_INVALID",
+ e.toString()));
}
if (pointName != null && pointName.length() > 0) {
nvp.add("pointName", pointName);
@@ -258,7 +277,9 @@ public class CMSIssuingDistributionPointExtension
try {
reasons = config.getString(PROP_REASONS, null);
} catch (EBaseException e) {
- log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_INVALID_PROPERTY", PROP_REASONS, e.toString()));
+ log(ILogger.LL_FAILURE,
+ CMS.getLogMessage("CRL_INVALID_PROPERTY", PROP_REASONS,
+ e.toString()));
}
if (reasons != null && reasons.length() > 0) {
nvp.add(PROP_REASONS, reasons);
@@ -272,28 +293,27 @@ public class CMSIssuingDistributionPointExtension
nvp.add(PROP_CACERTS, String.valueOf(caCertsOnly));
} catch (EBaseException e) {
nvp.add(PROP_CACERTS, "false");
- log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_INVALID_PROPERTY", "caCertsOnly", e.toString()));
+ log(ILogger.LL_FAILURE,
+ CMS.getLogMessage("CRL_INVALID_PROPERTY", "caCertsOnly",
+ e.toString()));
}
// Disable these for now unitl we support them fully
-/*
- try {
- boolean userCertsOnly = config.getBoolean(PROP_USERCERTS, false);
-
- nvp.add(PROP_USERCERTS, String.valueOf(userCertsOnly));
- } catch (EBaseException e) {
- nvp.add(PROP_USERCERTS, "false");
- log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_INVALID_PROPERTY", "userCertsOnly", e.toString()));
- }
-
- try {
- boolean indirectCRL = config.getBoolean(PROP_INDIRECT, false);
-
- nvp.add(PROP_INDIRECT, String.valueOf(indirectCRL));
- } catch (EBaseException e) {
- nvp.add(PROP_INDIRECT, "false");
- log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_INVALID_PROPERTY", "indirectCRL", e.toString()));
- }
-*/
+ /*
+ * try { boolean userCertsOnly = config.getBoolean(PROP_USERCERTS,
+ * false);
+ *
+ * nvp.add(PROP_USERCERTS, String.valueOf(userCertsOnly)); } catch
+ * (EBaseException e) { nvp.add(PROP_USERCERTS, "false");
+ * log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_INVALID_PROPERTY",
+ * "userCertsOnly", e.toString())); }
+ *
+ * try { boolean indirectCRL = config.getBoolean(PROP_INDIRECT, false);
+ *
+ * nvp.add(PROP_INDIRECT, String.valueOf(indirectCRL)); } catch
+ * (EBaseException e) { nvp.add(PROP_INDIRECT, "false");
+ * log(ILogger.LL_FAILURE, CMS.getLogMessage("CRL_INVALID_PROPERTY",
+ * "indirectCRL", e.toString())); }
+ */
}
public String[] getExtendedPluginInfo(Locale locale) {
@@ -305,32 +325,36 @@ public class CMSIssuingDistributionPointExtension
sb_reasons.append(reasonFlags[i]);
}
String[] params = {
- //"type;choice(CRLExtension,CRLEntryExtension);"+
- //"CRL Extension type. This field is not editable.",
+ // "type;choice(CRLExtension,CRLEntryExtension);"+
+ // "CRL Extension type. This field is not editable.",
"enable;boolean;Check to enable Issuing Distribution Point CRL extension.",
"critical;boolean;Set criticality for Issuing Distribution Point CRL extension.",
- PROP_POINTTYPE + ";choice(" + PROP_DIRNAME + "," + PROP_URINAME + "," +
- PROP_RDNNAME + ");Select Issuing Distribution Point name type.",
- PROP_POINTNAME + ";string;Enter Issuing Distribution Point name " +
- "corresponding to the selected point type.",
- PROP_REASONS + ";string;Select any combination of the following reasons: " +
- sb_reasons.toString(),
- PROP_CACERTS + ";boolean;Check if CRL contains CA certificates only",
- // Remove these from the UI until they can be supported fully.
- // PROP_USERCERTS + ";boolean;Check if CRL contains user certificates only",
- // PROP_INDIRECT + ";boolean;Check if CRL is built indirectly.",
- IExtendedPluginInfo.HELP_TOKEN +
- ";configuration-ca-edit-crlextension-issuingdistributionpoint",
- IExtendedPluginInfo.HELP_TEXT +
- ";The issuing distribution point is a critical CRL extension " +
- "that identifies the CRL distribution point for a particular CRL."
- };
+ PROP_POINTTYPE + ";choice(" + PROP_DIRNAME + "," + PROP_URINAME
+ + "," + PROP_RDNNAME
+ + ");Select Issuing Distribution Point name type.",
+ PROP_POINTNAME
+ + ";string;Enter Issuing Distribution Point name "
+ + "corresponding to the selected point type.",
+ PROP_REASONS
+ + ";string;Select any combination of the following reasons: "
+ + sb_reasons.toString(),
+ PROP_CACERTS
+ + ";boolean;Check if CRL contains CA certificates only",
+ // Remove these from the UI until they can be supported fully.
+ // PROP_USERCERTS +
+ // ";boolean;Check if CRL contains user certificates only",
+ // PROP_INDIRECT + ";boolean;Check if CRL is built indirectly.",
+ IExtendedPluginInfo.HELP_TOKEN
+ + ";configuration-ca-edit-crlextension-issuingdistributionpoint",
+ IExtendedPluginInfo.HELP_TEXT
+ + ";The issuing distribution point is a critical CRL extension "
+ + "that identifies the CRL distribution point for a particular CRL." };
return params;
}
private void log(int level, String msg) {
mLogger.log(ILogger.EV_SYSTEM, null, ILogger.S_CA, level,
- "CMSIssuingDistributionPointExtension - " + msg);
+ "CMSIssuingDistributionPointExtension - " + msg);
}
-}
+}