summaryrefslogtreecommitdiffstats
path: root/pki/base/common/src/com/netscape/cms/profile/input
diff options
context:
space:
mode:
Diffstat (limited to 'pki/base/common/src/com/netscape/cms/profile/input')
-rw-r--r--pki/base/common/src/com/netscape/cms/profile/input/CMCCertReqInput.java56
-rw-r--r--pki/base/common/src/com/netscape/cms/profile/input/CertReqInput.java109
-rw-r--r--pki/base/common/src/com/netscape/cms/profile/input/DualKeyGenInput.java92
-rw-r--r--pki/base/common/src/com/netscape/cms/profile/input/EnrollInput.java106
-rw-r--r--pki/base/common/src/com/netscape/cms/profile/input/FileSigningInput.java86
-rw-r--r--pki/base/common/src/com/netscape/cms/profile/input/GenericInput.java91
-rw-r--r--pki/base/common/src/com/netscape/cms/profile/input/ImageInput.java19
-rw-r--r--pki/base/common/src/com/netscape/cms/profile/input/KeyGenInput.java110
-rw-r--r--pki/base/common/src/com/netscape/cms/profile/input/SerialNumRenewInput.java24
-rw-r--r--pki/base/common/src/com/netscape/cms/profile/input/SubjectDNInput.java58
-rw-r--r--pki/base/common/src/com/netscape/cms/profile/input/SubjectNameInput.java264
-rw-r--r--pki/base/common/src/com/netscape/cms/profile/input/SubmitterInfoInput.java27
-rw-r--r--pki/base/common/src/com/netscape/cms/profile/input/nsHKeyCertReqInput.java119
-rw-r--r--pki/base/common/src/com/netscape/cms/profile/input/nsNKeyCertReqInput.java63
14 files changed, 664 insertions, 560 deletions
diff --git a/pki/base/common/src/com/netscape/cms/profile/input/CMCCertReqInput.java b/pki/base/common/src/com/netscape/cms/profile/input/CMCCertReqInput.java
index 88255c3e..d067f1e6 100644
--- a/pki/base/common/src/com/netscape/cms/profile/input/CMCCertReqInput.java
+++ b/pki/base/common/src/com/netscape/cms/profile/input/CMCCertReqInput.java
@@ -17,6 +17,7 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cms.profile.input;
+
import java.util.Locale;
import netscape.security.x509.X509CertInfo;
@@ -34,19 +35,23 @@ import com.netscape.certsrv.property.IDescriptor;
import com.netscape.certsrv.request.IRequest;
import com.netscape.cms.profile.common.EnrollProfile;
+
/**
- * This class implements the certificate request input. This input populates 2
- * main fields to the enrollment page: 1/ Certificate Request Type, 2/
- * Certificate Request
+ * This class implements the certificate request input.
+ * This input populates 2 main fields to the enrollment page:
+ * 1/ Certificate Request Type, 2/ Certificate Request
* <p>
*
- * This input usually is used by an enrollment profile for certificate requests.
- *
+ * This input usually is used by an enrollment profile for
+ * certificate requests.
+ *
* @version $Revision$, $Date$
*/
-public class CMCCertReqInput extends EnrollInput implements IProfileInput {
- public static final String VAL_CERT_REQUEST_TYPE = EnrollProfile.CTX_CERT_REQUEST_TYPE;
- public static final String VAL_CERT_REQUEST = EnrollProfile.CTX_CERT_REQUEST;
+public class CMCCertReqInput extends EnrollInput implements IProfileInput {
+ public static final String VAL_CERT_REQUEST_TYPE =
+ EnrollProfile.CTX_CERT_REQUEST_TYPE;
+ public static final String VAL_CERT_REQUEST =
+ EnrollProfile.CTX_CERT_REQUEST;
public EnrollProfile mEnrollProfile = null;
@@ -58,7 +63,7 @@ public class CMCCertReqInput extends EnrollInput implements IProfileInput {
* Initializes this default policy.
*/
public void init(IProfile profile, IConfigStore config)
- throws EProfileException {
+ throws EProfileException {
super.init(profile, config);
mEnrollProfile = (EnrollProfile) profile;
@@ -82,38 +87,39 @@ public class CMCCertReqInput extends EnrollInput implements IProfileInput {
* Populates the request with this policy default.
*/
public void populate(IProfileContext ctx, IRequest request)
- throws EProfileException {
+ throws EProfileException {
String cert_request = ctx.get(VAL_CERT_REQUEST);
- X509CertInfo info = request
- .getExtDataInCertInfo(EnrollProfile.REQUEST_CERTINFO);
+ X509CertInfo info =
+ request.getExtDataInCertInfo(EnrollProfile.REQUEST_CERTINFO);
- TaggedRequest msgs[] = mEnrollProfile.parseCMC(getLocale(request),
- cert_request);
+ TaggedRequest msgs[] = mEnrollProfile.parseCMC(getLocale(request), cert_request);
if (msgs == null) {
- return;
+ return;
}
// This profile only handle the first request in CRMF
- Integer seqNum = request
- .getExtDataInInteger(EnrollProfile.REQUEST_SEQ_NUM);
+ Integer seqNum = request.getExtDataInInteger(EnrollProfile.REQUEST_SEQ_NUM);
if (seqNum == null) {
- throw new EProfileException(CMS.getUserMessage(getLocale(request),
- "CMS_PROFILE_UNKNOWN_SEQ_NUM"));
+ throw new EProfileException(
+ CMS.getUserMessage(getLocale(request),
+ "CMS_PROFILE_UNKNOWN_SEQ_NUM"));
}
- mEnrollProfile.fillTaggedRequest(getLocale(request),
- msgs[seqNum.intValue()], info, request);
+ mEnrollProfile.fillTaggedRequest(getLocale(request), msgs[seqNum.intValue()], info, request);
request.setExtData(EnrollProfile.REQUEST_CERTINFO, info);
}
/**
- * Retrieves the descriptor of the given value parameter by name.
+ * Retrieves the descriptor of the given value
+ * parameter by name.
*/
public IDescriptor getValueDescriptor(Locale locale, String name) {
if (name.equals(VAL_CERT_REQUEST)) {
- return new Descriptor(IDescriptor.CERT_REQUEST, null, null,
- CMS.getUserMessage(locale, "CMS_PROFILE_INPUT_CERT_REQ"));
- }
+ return new Descriptor(IDescriptor.CERT_REQUEST, null,
+ null,
+ CMS.getUserMessage(locale,
+ "CMS_PROFILE_INPUT_CERT_REQ"));
+ }
return null;
}
}
diff --git a/pki/base/common/src/com/netscape/cms/profile/input/CertReqInput.java b/pki/base/common/src/com/netscape/cms/profile/input/CertReqInput.java
index 241d6c01..12a4f549 100644
--- a/pki/base/common/src/com/netscape/cms/profile/input/CertReqInput.java
+++ b/pki/base/common/src/com/netscape/cms/profile/input/CertReqInput.java
@@ -17,6 +17,7 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cms.profile.input;
+
import java.util.Locale;
import netscape.security.pkcs.PKCS10;
@@ -37,19 +38,23 @@ import com.netscape.certsrv.property.IDescriptor;
import com.netscape.certsrv.request.IRequest;
import com.netscape.cms.profile.common.EnrollProfile;
+
/**
- * This class implements the certificate request input. This input populates 2
- * main fields to the enrollment page: 1/ Certificate Request Type, 2/
- * Certificate Request
+ * This class implements the certificate request input.
+ * This input populates 2 main fields to the enrollment page:
+ * 1/ Certificate Request Type, 2/ Certificate Request
* <p>
*
- * This input usually is used by an enrollment profile for certificate requests.
- *
+ * This input usually is used by an enrollment profile for
+ * certificate requests.
+ *
* @version $Revision$, $Date$
*/
-public class CertReqInput extends EnrollInput implements IProfileInput {
- public static final String VAL_CERT_REQUEST_TYPE = EnrollProfile.CTX_CERT_REQUEST_TYPE;
- public static final String VAL_CERT_REQUEST = EnrollProfile.CTX_CERT_REQUEST;
+public class CertReqInput extends EnrollInput implements IProfileInput {
+ public static final String VAL_CERT_REQUEST_TYPE =
+ EnrollProfile.CTX_CERT_REQUEST_TYPE;
+ public static final String VAL_CERT_REQUEST =
+ EnrollProfile.CTX_CERT_REQUEST;
public EnrollProfile mEnrollProfile = null;
@@ -62,7 +67,7 @@ public class CertReqInput extends EnrollInput implements IProfileInput {
* Initializes this default policy.
*/
public void init(IProfile profile, IConfigStore config)
- throws EProfileException {
+ throws EProfileException {
super.init(profile, config);
mEnrollProfile = (EnrollProfile) profile;
@@ -86,97 +91,97 @@ public class CertReqInput extends EnrollInput implements IProfileInput {
* Populates the request with this policy default.
*/
public void populate(IProfileContext ctx, IRequest request)
- throws EProfileException {
+ throws EProfileException {
String cert_request_type = ctx.get(VAL_CERT_REQUEST_TYPE);
String cert_request = ctx.get(VAL_CERT_REQUEST);
- X509CertInfo info = request
- .getExtDataInCertInfo(EnrollProfile.REQUEST_CERTINFO);
+ X509CertInfo info =
+ request.getExtDataInCertInfo(EnrollProfile.REQUEST_CERTINFO);
if (cert_request_type == null) {
- CMS.debug("CertReqInput: populate - invalid cert request type "
- + "");
- throw new EProfileException(CMS.getUserMessage(getLocale(request),
- "CMS_PROFILE_UNKNOWN_CERT_REQ_TYPE", ""));
+ CMS.debug("CertReqInput: populate - invalid cert request type " +
+ "");
+ throw new EProfileException(
+ CMS.getUserMessage(getLocale(request),
+ "CMS_PROFILE_UNKNOWN_CERT_REQ_TYPE",
+ ""));
}
if (cert_request_type.equals(EnrollProfile.REQ_TYPE_PKCS10)) {
- PKCS10 pkcs10 = mEnrollProfile.parsePKCS10(getLocale(request),
- cert_request);
+ PKCS10 pkcs10 = mEnrollProfile.parsePKCS10(getLocale(request), cert_request);
if (pkcs10 == null) {
throw new EProfileException(CMS.getUserMessage(
- getLocale(request), "CMS_PROFILE_NO_CERT_REQ"));
+ getLocale(request), "CMS_PROFILE_NO_CERT_REQ"));
}
- mEnrollProfile
- .fillPKCS10(getLocale(request), pkcs10, info, request);
+ mEnrollProfile.fillPKCS10(getLocale(request), pkcs10, info, request);
} else if (cert_request_type.startsWith(EnrollProfile.REQ_TYPE_KEYGEN)) {
- DerInputStream keygen = mEnrollProfile.parseKeyGen(
- getLocale(request), cert_request);
+ DerInputStream keygen = mEnrollProfile.parseKeyGen(getLocale(request), cert_request);
if (keygen == null) {
throw new EProfileException(CMS.getUserMessage(
- getLocale(request), "CMS_PROFILE_NO_CERT_REQ"));
+ getLocale(request), "CMS_PROFILE_NO_CERT_REQ"));
}
- mEnrollProfile
- .fillKeyGen(getLocale(request), keygen, info, request);
+ mEnrollProfile.fillKeyGen(getLocale(request), keygen, info, request);
} else if (cert_request_type.startsWith(EnrollProfile.REQ_TYPE_CRMF)) {
- CertReqMsg msgs[] = mEnrollProfile.parseCRMF(getLocale(request),
- cert_request);
+ CertReqMsg msgs[] = mEnrollProfile.parseCRMF(getLocale(request), cert_request);
if (msgs == null) {
throw new EProfileException(CMS.getUserMessage(
- getLocale(request), "CMS_PROFILE_NO_CERT_REQ"));
+ getLocale(request), "CMS_PROFILE_NO_CERT_REQ"));
}
for (int x = 0; x < msgs.length; x++) {
verifyPOP(getLocale(request), msgs[x]);
}
// This profile only handle the first request in CRMF
- Integer seqNum = request
- .getExtDataInInteger(EnrollProfile.REQUEST_SEQ_NUM);
+ Integer seqNum = request.getExtDataInInteger(EnrollProfile.REQUEST_SEQ_NUM);
- mEnrollProfile.fillCertReqMsg(getLocale(request),
- msgs[seqNum.intValue()], info, request);
+ mEnrollProfile.fillCertReqMsg(getLocale(request), msgs[seqNum.intValue()], info, request
+ );
} else if (cert_request_type.startsWith(EnrollProfile.REQ_TYPE_CMC)) {
- TaggedRequest msgs[] = mEnrollProfile.parseCMC(getLocale(request),
- cert_request);
+ TaggedRequest msgs[] = mEnrollProfile.parseCMC(getLocale(request), cert_request);
if (msgs == null) {
throw new EProfileException(CMS.getUserMessage(
- getLocale(request), "CMS_PROFILE_NO_CERT_REQ"));
+ getLocale(request), "CMS_PROFILE_NO_CERT_REQ"));
}
// This profile only handle the first request in CRMF
- Integer seqNum = request
- .getExtDataInInteger(EnrollProfile.REQUEST_SEQ_NUM);
- if (seqNum == null) {
- throw new EProfileException(CMS.getUserMessage(
- getLocale(request), "CMS_PROFILE_UNKNOWN_SEQ_NUM"));
+ Integer seqNum = request.getExtDataInInteger(EnrollProfile.REQUEST_SEQ_NUM);
+ if (seqNum == null) {
+ throw new EProfileException(
+ CMS.getUserMessage(getLocale(request),
+ "CMS_PROFILE_UNKNOWN_SEQ_NUM"));
}
- mEnrollProfile.fillTaggedRequest(getLocale(request),
- msgs[seqNum.intValue()], info, request);
+ mEnrollProfile.fillTaggedRequest(getLocale(request), msgs[seqNum.intValue()], info, request);
} else {
// error
- CMS.debug("CertReqInput: populate - invalid cert request type "
- + cert_request_type);
- throw new EProfileException(CMS.getUserMessage(getLocale(request),
- "CMS_PROFILE_UNKNOWN_CERT_REQ_TYPE", cert_request_type));
+ CMS.debug("CertReqInput: populate - invalid cert request type " +
+ cert_request_type);
+ throw new EProfileException(
+ CMS.getUserMessage(getLocale(request),
+ "CMS_PROFILE_UNKNOWN_CERT_REQ_TYPE",
+ cert_request_type));
}
request.setExtData(EnrollProfile.REQUEST_CERTINFO, info);
}
/**
- * Retrieves the descriptor of the given value parameter by name.
+ * Retrieves the descriptor of the given value
+ * parameter by name.
*/
public IDescriptor getValueDescriptor(Locale locale, String name) {
if (name.equals(VAL_CERT_REQUEST_TYPE)) {
- return new Descriptor(IDescriptor.CERT_REQUEST_TYPE, null, null,
+ return new Descriptor(IDescriptor.CERT_REQUEST_TYPE, null,
+ null,
CMS.getUserMessage(locale,
- "CMS_PROFILE_INPUT_CERT_REQ_TYPE"));
+ "CMS_PROFILE_INPUT_CERT_REQ_TYPE"));
} else if (name.equals(VAL_CERT_REQUEST)) {
- return new Descriptor(IDescriptor.CERT_REQUEST, null, null,
- CMS.getUserMessage(locale, "CMS_PROFILE_INPUT_CERT_REQ"));
+ return new Descriptor(IDescriptor.CERT_REQUEST, null,
+ null,
+ CMS.getUserMessage(locale,
+ "CMS_PROFILE_INPUT_CERT_REQ"));
}
return null;
}
diff --git a/pki/base/common/src/com/netscape/cms/profile/input/DualKeyGenInput.java b/pki/base/common/src/com/netscape/cms/profile/input/DualKeyGenInput.java
index 227dbc79..b887807c 100644
--- a/pki/base/common/src/com/netscape/cms/profile/input/DualKeyGenInput.java
+++ b/pki/base/common/src/com/netscape/cms/profile/input/DualKeyGenInput.java
@@ -17,6 +17,7 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cms.profile.input;
+
import java.util.Locale;
import netscape.security.pkcs.PKCS10;
@@ -36,21 +37,26 @@ import com.netscape.certsrv.property.IDescriptor;
import com.netscape.certsrv.request.IRequest;
import com.netscape.cms.profile.common.EnrollProfile;
+
/**
- * This class implements the dual key generation input. This input populates
- * parameters to the enrollment pages so that a CRMF request containing 2
- * certificate requests will be generated.
+ * This class implements the dual key generation input.
+ * This input populates parameters to the enrollment
+ * pages so that a CRMF request containing 2 certificate
+ * requests will be generated.
* <p>
- *
- * This input can only be used with Netscape 7.x or later clients.
+ *
+ * This input can only be used with Netscape 7.x or later
+ * clients.
* <p>
- *
+ *
* @version $Revision$, $Date$
*/
-public class DualKeyGenInput extends EnrollInput implements IProfileInput {
+public class DualKeyGenInput extends EnrollInput implements IProfileInput {
- public static final String VAL_KEYGEN_REQUEST_TYPE = EnrollProfile.CTX_CERT_REQUEST_TYPE;
- public static final String VAL_KEYGEN_REQUEST = EnrollProfile.CTX_CERT_REQUEST;
+ public static final String VAL_KEYGEN_REQUEST_TYPE =
+ EnrollProfile.CTX_CERT_REQUEST_TYPE;
+ public static final String VAL_KEYGEN_REQUEST =
+ EnrollProfile.CTX_CERT_REQUEST;
public EnrollProfile mEnrollProfile = null;
@@ -63,7 +69,7 @@ public class DualKeyGenInput extends EnrollInput implements IProfileInput {
* Initializes this default policy.
*/
public void init(IProfile profile, IConfigStore config)
- throws EProfileException {
+ throws EProfileException {
super.init(profile, config);
mEnrollProfile = (EnrollProfile) profile;
}
@@ -86,73 +92,73 @@ public class DualKeyGenInput extends EnrollInput implements IProfileInput {
* Populates the request with this policy default.
*/
public void populate(IProfileContext ctx, IRequest request)
- throws EProfileException {
+ throws EProfileException {
String keygen_request_type = ctx.get(VAL_KEYGEN_REQUEST_TYPE);
String keygen_request = ctx.get(VAL_KEYGEN_REQUEST);
- X509CertInfo info = request
- .getExtDataInCertInfo(EnrollProfile.REQUEST_CERTINFO);
+ X509CertInfo info =
+ request.getExtDataInCertInfo(EnrollProfile.REQUEST_CERTINFO);
if (keygen_request_type == null) {
- CMS.debug("DualKeyGenInput: populate - invalid cert request type "
- + "");
- throw new EProfileException(CMS.getUserMessage(getLocale(request),
- "CMS_PROFILE_UNKNOWN_CERT_REQ_TYPE", ""));
+ CMS.debug("DualKeyGenInput: populate - invalid cert request type " +
+ "");
+ throw new EProfileException(
+ CMS.getUserMessage(getLocale(request),
+ "CMS_PROFILE_UNKNOWN_CERT_REQ_TYPE",
+ ""));
}
if (keygen_request_type.startsWith("pkcs10")) {
- PKCS10 pkcs10 = mEnrollProfile.parsePKCS10(getLocale(request),
- keygen_request);
+ PKCS10 pkcs10 = mEnrollProfile.parsePKCS10(getLocale(request), keygen_request);
- mEnrollProfile
- .fillPKCS10(getLocale(request), pkcs10, info, request);
+ mEnrollProfile.fillPKCS10(getLocale(request), pkcs10, info, request);
} else if (keygen_request_type.startsWith("keygen")) {
- DerInputStream keygen = mEnrollProfile.parseKeyGen(
- getLocale(request), keygen_request);
+ DerInputStream keygen = mEnrollProfile.parseKeyGen(getLocale(request), keygen_request);
- mEnrollProfile
- .fillKeyGen(getLocale(request), keygen, info, request);
+ mEnrollProfile.fillKeyGen(getLocale(request), keygen, info, request);
} else if (keygen_request_type.startsWith("crmf")) {
- CertReqMsg msgs[] = mEnrollProfile.parseCRMF(getLocale(request),
- keygen_request);
+ CertReqMsg msgs[] = mEnrollProfile.parseCRMF(getLocale(request), keygen_request);
if (msgs == null) {
throw new EProfileException(CMS.getUserMessage(
- getLocale(request), "CMS_PROFILE_NO_CERT_REQ"));
+ getLocale(request), "CMS_PROFILE_NO_CERT_REQ"));
}
for (int x = 0; x < msgs.length; x++) {
verifyPOP(getLocale(request), msgs[x]);
}
// This profile only handle the first request in CRMF
- Integer seqNum = request
- .getExtDataInInteger(EnrollProfile.REQUEST_SEQ_NUM);
+ Integer seqNum = request.getExtDataInInteger(EnrollProfile.REQUEST_SEQ_NUM);
- if (seqNum == null) {
- throw new EProfileException(CMS.getUserMessage(
- getLocale(request), "CMS_PROFILE_UNKNOWN_SEQ_NUM"));
+ if (seqNum == null) {
+ throw new EProfileException(
+ CMS.getUserMessage(getLocale(request),
+ "CMS_PROFILE_UNKNOWN_SEQ_NUM"));
}
- mEnrollProfile.fillCertReqMsg(getLocale(request),
- msgs[seqNum.intValue()], info, request);
+ mEnrollProfile.fillCertReqMsg(getLocale(request), msgs[seqNum.intValue()], info, request);
} else {
// error
- CMS.debug("DualKeyGenInput: populate - "
- + "invalid cert request type " + keygen_request_type);
- throw new EProfileException(CMS.getUserMessage(getLocale(request),
- "CMS_PROFILE_UNKNOWN_CERT_REQ_TYPE", keygen_request_type));
+ CMS.debug("DualKeyGenInput: populate - " +
+ "invalid cert request type " + keygen_request_type);
+ throw new EProfileException(CMS.getUserMessage(
+ getLocale(request),
+ "CMS_PROFILE_UNKNOWN_CERT_REQ_TYPE",
+ keygen_request_type));
}
request.setExtData(EnrollProfile.REQUEST_CERTINFO, info);
}
/**
- * Retrieves the descriptor of the given value parameter by name.
+ * Retrieves the descriptor of the given value
+ * parameter by name.
*/
public IDescriptor getValueDescriptor(Locale locale, String name) {
if (name.equals(VAL_KEYGEN_REQUEST_TYPE)) {
return new Descriptor(IDescriptor.DUAL_KEYGEN_REQUEST_TYPE, null,
- null, CMS.getUserMessage(locale,
- "CMS_PROFILE_INPUT_KEYGEN_REQ_TYPE"));
+ null,
+ CMS.getUserMessage(locale, "CMS_PROFILE_INPUT_KEYGEN_REQ_TYPE"));
} else if (name.equals(VAL_KEYGEN_REQUEST)) {
- return new Descriptor(IDescriptor.DUAL_KEYGEN_REQUEST, null, null,
+ return new Descriptor(IDescriptor.DUAL_KEYGEN_REQUEST, null,
+ null,
CMS.getUserMessage(locale, "CMS_PROFILE_INPUT_KEYGEN_REQ"));
}
return null;
diff --git a/pki/base/common/src/com/netscape/cms/profile/input/EnrollInput.java b/pki/base/common/src/com/netscape/cms/profile/input/EnrollInput.java
index 71b7a97c..1eaf476b 100644
--- a/pki/base/common/src/com/netscape/cms/profile/input/EnrollInput.java
+++ b/pki/base/common/src/com/netscape/cms/profile/input/EnrollInput.java
@@ -17,6 +17,7 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cms.profile.input;
+
import java.util.Enumeration;
import java.util.Locale;
import java.util.Vector;
@@ -40,14 +41,16 @@ import com.netscape.certsrv.property.IDescriptor;
import com.netscape.certsrv.request.IRequest;
import com.netscape.cms.profile.common.EnrollProfile;
+
/**
* This class implements the base enrollment input.
- *
+ *
* @version $Revision$, $Date$
*/
-public abstract class EnrollInput implements IProfileInput {
+public abstract class EnrollInput implements IProfileInput {
- private final static String LOGGING_SIGNED_AUDIT_PROOF_OF_POSSESSION = "LOGGING_SIGNED_AUDIT_PROOF_OF_POSSESSION_2";
+ private final static String LOGGING_SIGNED_AUDIT_PROOF_OF_POSSESSION =
+ "LOGGING_SIGNED_AUDIT_PROOF_OF_POSSESSION_2";
protected IConfigStore mConfig = null;
protected Vector mValueNames = new Vector();
@@ -55,12 +58,12 @@ public abstract class EnrollInput implements IProfileInput {
protected IProfile mProfile = null;
protected ILogger mSignedAuditLogger = CMS.getSignedAuditLogger();
-
+
/**
* Initializes this default policy.
*/
public void init(IProfile profile, IConfigStore config)
- throws EProfileException {
+ throws EProfileException {
mConfig = config;
mProfile = profile;
}
@@ -71,17 +74,17 @@ public abstract class EnrollInput implements IProfileInput {
/**
* Populates the request with this policy default.
- *
+ *
* @param ctx profile context
* @param request request
* @exception EProfileException failed to populate
*/
public abstract void populate(IProfileContext ctx, IRequest request)
- throws EProfileException;
+ throws EProfileException;
/**
* Retrieves the localizable name of this policy.
- *
+ *
* @param locale user locale
* @return localized input name
*/
@@ -89,21 +92,23 @@ public abstract class EnrollInput implements IProfileInput {
/**
* Retrieves the localizable description of this policy.
- *
+ *
* @param locale user locale
* @return localized input description
*/
public abstract String getText(Locale locale);
/**
- * Retrieves the descriptor of the given value property by name.
- *
+ * Retrieves the descriptor of the given value
+ * property by name.
+ *
* @param locale user locale
* @param name property name
* @return descriptor of the property
*/
public abstract IDescriptor getValueDescriptor(Locale locale, String name);
+
public void addValueName(String name) {
mValueNames.addElement(name);
}
@@ -123,7 +128,8 @@ public abstract class EnrollInput implements IProfileInput {
return mConfigNames.elements();
}
- public void setConfig(String name, String value) throws EPropertyException {
+ public void setConfig(String name, String value)
+ throws EPropertyException {
if (mConfig.getSubStore("params") == null) {
//
} else {
@@ -135,7 +141,7 @@ public abstract class EnrollInput implements IProfileInput {
try {
if (mConfig == null) {
return null;
- }
+ }
if (mConfig.getSubStore("params") != null) {
return mConfig.getSubStore("params").getString(name);
}
@@ -149,7 +155,7 @@ public abstract class EnrollInput implements IProfileInput {
}
public String getValue(String name, Locale locale, IRequest request)
- throws EProfileException {
+ throws EProfileException {
return request.getExtDataInString(name);
}
@@ -157,14 +163,14 @@ public abstract class EnrollInput implements IProfileInput {
* Sets the value of the given value parameter by name.
*/
public void setValue(String name, Locale locale, IRequest request,
- String value) throws EPropertyException {
+ String value) throws EPropertyException {
request.setExtData(name, value);
}
public Locale getLocale(IRequest request) {
Locale locale = null;
- String language = request
- .getExtDataInString(EnrollProfile.REQUEST_LOCALE);
+ String language = request.getExtDataInString(
+ EnrollProfile.REQUEST_LOCALE);
if (language != null) {
locale = new Locale(language);
}
@@ -175,16 +181,16 @@ public abstract class EnrollInput implements IProfileInput {
return null;
}
- public void verifyPOP(Locale locale, CertReqMsg certReqMsg)
- throws EProfileException {
- CMS.debug("EnrollInput ::in verifyPOP");
+ public void verifyPOP(Locale locale, CertReqMsg certReqMsg)
+ throws EProfileException {
+ CMS.debug("EnrollInput ::in verifyPOP");
String auditMessage = null;
String auditSubjectID = auditSubjectID();
- if (!certReqMsg.hasPop()) {
+ if (!certReqMsg.hasPop()) {
CMS.debug("CertReqMsg has not POP, return");
- return;
+ return;
}
ProofOfPossession pop = certReqMsg.getPop();
ProofOfPossession.Type popType = pop.getType();
@@ -196,53 +202,54 @@ public abstract class EnrollInput implements IProfileInput {
try {
if (CMS.getConfigStore().getBoolean("cms.skipPOPVerify", false)) {
- CMS.debug("skipPOPVerify on, return");
- return;
+ CMS.debug("skipPOPVerify on, return");
+ return;
}
CMS.debug("POP verification begins:");
CryptoManager cm = CryptoManager.getInstance();
CryptoToken verifyToken = null;
- String tokenName = CMS.getConfigStore().getString(
- "ca.requestVerify.token", "internal");
+ String tokenName = CMS.getConfigStore().getString("ca.requestVerify.token", "internal");
if (tokenName.equals("internal")) {
CMS.debug("POP verification using internal token");
certReqMsg.verify();
} else {
- CMS.debug("POP verification using token:" + tokenName);
+ CMS.debug("POP verification using token:"+ tokenName);
verifyToken = cm.getTokenByName(tokenName);
certReqMsg.verify(verifyToken);
}
// store a message in the signed audit log file
auditMessage = CMS.getLogMessage(
- LOGGING_SIGNED_AUDIT_PROOF_OF_POSSESSION, auditSubjectID,
- ILogger.SUCCESS);
- audit(auditMessage);
+ LOGGING_SIGNED_AUDIT_PROOF_OF_POSSESSION,
+ auditSubjectID,
+ ILogger.SUCCESS );
+ audit( auditMessage );
} catch (Exception e) {
- CMS.debug("Failed POP verify! " + e.toString());
+ CMS.debug("Failed POP verify! "+e.toString());
CMS.debug(e);
// store a message in the signed audit log file
auditMessage = CMS.getLogMessage(
- LOGGING_SIGNED_AUDIT_PROOF_OF_POSSESSION, auditSubjectID,
- ILogger.FAILURE);
+ LOGGING_SIGNED_AUDIT_PROOF_OF_POSSESSION,
+ auditSubjectID,
+ ILogger.FAILURE );
- audit(auditMessage);
+ audit( auditMessage );
- throw new EProfileException(CMS.getUserMessage(locale,
- "CMS_POP_VERIFICATION_ERROR"));
+ throw new EProfileException(CMS.getUserMessage(locale,
+ "CMS_POP_VERIFICATION_ERROR"));
}
}
/**
* Signed Audit Log
- *
- * This method is inherited by all extended "CMSServlet"s, and is called to
- * store messages to the signed audit log.
+ *
+ * This method is inherited by all extended "CMSServlet"s,
+ * and is called to store messages to the signed audit log.
* <P>
- *
+ *
* @param msg signed audit log message
*/
protected void audit(String msg) {
@@ -253,17 +260,21 @@ public abstract class EnrollInput implements IProfileInput {
return;
}
- mSignedAuditLogger.log(ILogger.EV_SIGNED_AUDIT, null,
- ILogger.S_SIGNED_AUDIT, ILogger.LL_SECURITY, msg);
+ mSignedAuditLogger.log(ILogger.EV_SIGNED_AUDIT,
+ null,
+ ILogger.S_SIGNED_AUDIT,
+ ILogger.LL_SECURITY,
+ msg);
}
/**
* Signed Audit Log Subject ID
- *
- * This method is inherited by all extended "CMSServlet"s, and is called to
- * obtain the "SubjectID" for a signed audit log message.
+ *
+ * This method is inherited by all extended "CMSServlet"s,
+ * and is called to obtain the "SubjectID" for
+ * a signed audit log message.
* <P>
- *
+ *
* @return id string containing the signed audit log message SubjectID
*/
protected String auditSubjectID() {
@@ -278,7 +289,8 @@ public abstract class EnrollInput implements IProfileInput {
SessionContext auditContext = SessionContext.getExistingContext();
if (auditContext != null) {
- subjectID = (String) auditContext.get(SessionContext.USER_ID);
+ subjectID = (String)
+ auditContext.get(SessionContext.USER_ID);
if (subjectID != null) {
subjectID = subjectID.trim();
diff --git a/pki/base/common/src/com/netscape/cms/profile/input/FileSigningInput.java b/pki/base/common/src/com/netscape/cms/profile/input/FileSigningInput.java
index fd1c56a1..70ede1e2 100644
--- a/pki/base/common/src/com/netscape/cms/profile/input/FileSigningInput.java
+++ b/pki/base/common/src/com/netscape/cms/profile/input/FileSigningInput.java
@@ -17,6 +17,7 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cms.profile.input;
+
import java.io.BufferedInputStream;
import java.net.URL;
import java.net.URLConnection;
@@ -33,13 +34,15 @@ import com.netscape.certsrv.property.Descriptor;
import com.netscape.certsrv.property.IDescriptor;
import com.netscape.certsrv.request.IRequest;
+
/**
- * This class implements the image input that collects a picture.
+ * This class implements the image
+ * input that collects a picture.
* <p>
- *
+ *
* @version $Revision$, $Date$
*/
-public class FileSigningInput extends EnrollInput implements IProfileInput {
+public class FileSigningInput extends EnrollInput implements IProfileInput {
public static final String URL = "file_signing_url";
public static final String TEXT = "file_signing_text";
@@ -56,7 +59,7 @@ public class FileSigningInput extends EnrollInput implements IProfileInput {
* Initializes this default policy.
*/
public void init(IProfile profile, IConfigStore config)
- throws EProfileException {
+ throws EProfileException {
super.init(profile, config);
}
@@ -64,24 +67,23 @@ public class FileSigningInput extends EnrollInput implements IProfileInput {
* Retrieves the localizable name of this policy.
*/
public String getName(Locale locale) {
- return CMS
- .getUserMessage(locale, "CMS_PROFILE_INPUT_FILE_SIGNING_NAME");
+ return CMS.getUserMessage(locale, "CMS_PROFILE_INPUT_FILE_SIGNING_NAME");
}
/**
* Retrieves the localizable description of this policy.
*/
public String getText(Locale locale) {
- return CMS
- .getUserMessage(locale, "CMS_PROFILE_INPUT_FILE_SIGNING_TEXT");
+ return CMS.getUserMessage(locale, "CMS_PROFILE_INPUT_FILE_SIGNING_TEXT");
}
- public String toHexString(byte data[]) {
+ public String toHexString(byte data[])
+ {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < data.length; i++) {
int v = data[i] & 0xff;
if (v <= 9) {
- sb.append("0");
+ sb.append("0");
}
sb.append(Integer.toHexString(v));
}
@@ -92,50 +94,52 @@ public class FileSigningInput extends EnrollInput implements IProfileInput {
* Populates the request with this policy default.
*/
public void populate(IProfileContext ctx, IRequest request)
- throws EProfileException {
+ throws EProfileException {
request.setExtData(TEXT, ctx.get(TEXT));
request.setExtData(URL, ctx.get(URL));
request.setExtData(DIGEST_TYPE, "SHA256");
-
+
try {
- // retrieve file and calculate the hash
- URL url = new URL(ctx.get(URL));
- URLConnection c = url.openConnection();
- c.setAllowUserInteraction(false);
- c.setDoInput(true);
- c.setDoOutput(false);
- c.setUseCaches(false);
- c.connect();
- int len = c.getContentLength();
- request.setExtData(SIZE, Integer.toString(len));
- BufferedInputStream is = new BufferedInputStream(c.getInputStream());
- byte data[] = new byte[len];
- is.read(data, 0, len);
- is.close();
+ // retrieve file and calculate the hash
+ URL url = new URL(ctx.get(URL));
+ URLConnection c = url.openConnection();
+ c.setAllowUserInteraction(false);
+ c.setDoInput(true);
+ c.setDoOutput(false);
+ c.setUseCaches(false);
+ c.connect();
+ int len = c.getContentLength();
+ request.setExtData(SIZE, Integer.toString(len));
+ BufferedInputStream is = new BufferedInputStream(c.getInputStream());
+ byte data[] = new byte[len];
+ is.read(data, 0, len);
+ is.close();
- // calculate digest
- MessageDigest digester = MessageDigest.getInstance("SHA256");
- byte digest[] = digester.digest(data);
- request.setExtData(DIGEST, toHexString(digest));
- } catch (Exception e) {
- CMS.debug("FileSigningInput populate failure " + e);
- throw new EProfileException(CMS.getUserMessage(getLocale(request),
- "CMS_PROFILE_FILE_NOT_FOUND"));
+ // calculate digest
+ MessageDigest digester = MessageDigest.getInstance("SHA256");
+ byte digest[] = digester.digest(data);
+ request.setExtData(DIGEST, toHexString(digest));
+ } catch (Exception e) {
+ CMS.debug("FileSigningInput populate failure " + e);
+ throw new EProfileException(
+ CMS.getUserMessage(getLocale(request),
+ "CMS_PROFILE_FILE_NOT_FOUND"));
}
}
/**
- * Retrieves the descriptor of the given value parameter by name.
+ * Retrieves the descriptor of the given value
+ * parameter by name.
*/
public IDescriptor getValueDescriptor(Locale locale, String name) {
if (name.equals(URL)) {
- return new Descriptor(IDescriptor.STRING, null, null,
- CMS.getUserMessage(locale,
- "CMS_PROFILE_INPUT_FILE_SIGNING_URL"));
+ return new Descriptor(IDescriptor.STRING, null,
+ null,
+ CMS.getUserMessage(locale, "CMS_PROFILE_INPUT_FILE_SIGNING_URL"));
} else if (name.equals(TEXT)) {
- return new Descriptor(IDescriptor.STRING, null, null,
- CMS.getUserMessage(locale,
- "CMS_PROFILE_INPUT_FILE_SIGNING_TEXT"));
+ return new Descriptor(IDescriptor.STRING, null,
+ null,
+ CMS.getUserMessage(locale, "CMS_PROFILE_INPUT_FILE_SIGNING_TEXT"));
}
return null;
}
diff --git a/pki/base/common/src/com/netscape/cms/profile/input/GenericInput.java b/pki/base/common/src/com/netscape/cms/profile/input/GenericInput.java
index a000da17..5aa85e0e 100644
--- a/pki/base/common/src/com/netscape/cms/profile/input/GenericInput.java
+++ b/pki/base/common/src/com/netscape/cms/profile/input/GenericInput.java
@@ -17,6 +17,7 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cms.profile.input;
+
import java.util.Enumeration;
import java.util.Locale;
import java.util.Vector;
@@ -31,13 +32,14 @@ import com.netscape.certsrv.property.Descriptor;
import com.netscape.certsrv.property.IDescriptor;
import com.netscape.certsrv.request.IRequest;
+
/**
* This class implements a generic input.
* <p>
- *
+ *
* @version $Revision$, $Date$
*/
-public class GenericInput extends EnrollInput implements IProfileInput {
+public class GenericInput extends EnrollInput implements IProfileInput {
public static final String CONFIG_NUM = "gi_num";
public static final String CONFIG_DISPLAY_NAME = "gi_display_name";
@@ -47,12 +49,12 @@ public class GenericInput extends EnrollInput implements IProfileInput {
public static final int DEF_NUM = 5;
public GenericInput() {
- int num = getNum();
- for (int i = 0; i < num; i++) {
- addConfigName(CONFIG_PARAM_NAME + i);
- addConfigName(CONFIG_DISPLAY_NAME + i);
- addConfigName(CONFIG_ENABLE + i);
- }
+ int num = getNum();
+ for (int i = 0; i < num; i++) {
+ addConfigName(CONFIG_PARAM_NAME + i);
+ addConfigName(CONFIG_DISPLAY_NAME + i);
+ addConfigName(CONFIG_ENABLE + i);
+ }
}
protected int getNum() {
@@ -73,7 +75,7 @@ public class GenericInput extends EnrollInput implements IProfileInput {
* Initializes this default policy.
*/
public void init(IProfile profile, IConfigStore config)
- throws EProfileException {
+ throws EProfileException {
super.init(profile, config);
}
@@ -81,78 +83,79 @@ public class GenericInput extends EnrollInput implements IProfileInput {
* Retrieves the localizable name of this policy.
*/
public String getName(Locale locale) {
- return CMS
- .getUserMessage(locale, "CMS_PROFILE_INPUT_GENERIC_NAME_NAME");
+ return CMS.getUserMessage(locale, "CMS_PROFILE_INPUT_GENERIC_NAME_NAME");
}
/**
* Retrieves the localizable description of this policy.
*/
public String getText(Locale locale) {
- return CMS
- .getUserMessage(locale, "CMS_PROFILE_INPUT_GENERIC_NAME_TEXT");
+ return CMS.getUserMessage(locale, "CMS_PROFILE_INPUT_GENERIC_NAME_TEXT");
}
/**
* Returns selected value names based on the configuration.
*/
public Enumeration getValueNames() {
- Vector v = new Vector();
- int num = getNum();
- for (int i = 0; i < num; i++) {
- String enable = getConfig(CONFIG_ENABLE + i);
- if (enable != null && enable.equals("true")) {
- v.addElement(getConfig(CONFIG_PARAM_NAME + i));
- }
- }
- return v.elements();
+ Vector v = new Vector();
+ int num = getNum();
+ for (int i = 0; i < num; i++) {
+ String enable = getConfig(CONFIG_ENABLE + i);
+ if (enable != null && enable.equals("true")) {
+ v.addElement(getConfig(CONFIG_PARAM_NAME + i));
+ }
+ }
+ return v.elements();
}
/**
* Populates the request with this policy default.
*/
public void populate(IProfileContext ctx, IRequest request)
- throws EProfileException {
+ throws EProfileException {
int num = getNum();
for (int i = 0; i < num; i++) {
- String enable = getConfig(CONFIG_ENABLE + i);
- if (enable != null && enable.equals("true")) {
+ String enable = getConfig(CONFIG_ENABLE + i);
+ if (enable != null && enable.equals("true")) {
String param = getConfig(CONFIG_PARAM_NAME + i);
request.setExtData(param, ctx.get(param));
- }
+ }
}
}
public IDescriptor getConfigDescriptor(Locale locale, String name) {
int num = getNum();
for (int i = 0; i < num; i++) {
- if (name.equals(CONFIG_PARAM_NAME + i)) {
- return new Descriptor(IDescriptor.STRING, null, null,
- CMS.getUserMessage(locale, "CMS_PROFILE_GI_PARAM_NAME")
- + i);
- } else if (name.equals(CONFIG_DISPLAY_NAME + i)) {
- return new Descriptor(IDescriptor.STRING, null, null,
- CMS.getUserMessage(locale,
- "CMS_PROFILE_GI_DISPLAY_NAME") + i);
- } else if (name.equals(CONFIG_ENABLE + i)) {
- return new Descriptor(IDescriptor.BOOLEAN, null, "false",
- CMS.getUserMessage(locale, "CMS_PROFILE_GI_ENABLE") + i);
- }
+ if (name.equals(CONFIG_PARAM_NAME + i)) {
+ return new Descriptor(IDescriptor.STRING, null,
+ null,
+ CMS.getUserMessage(locale, "CMS_PROFILE_GI_PARAM_NAME") + i);
+ } else if (name.equals(CONFIG_DISPLAY_NAME + i)) {
+ return new Descriptor(IDescriptor.STRING, null,
+ null,
+ CMS.getUserMessage(locale, "CMS_PROFILE_GI_DISPLAY_NAME") + i);
+ } else if (name.equals(CONFIG_ENABLE + i)) {
+ return new Descriptor(IDescriptor.BOOLEAN, null,
+ "false",
+ CMS.getUserMessage(locale, "CMS_PROFILE_GI_ENABLE") + i);
+ }
} // for
return null;
}
/**
- * Retrieves the descriptor of the given value parameter by name.
+ * Retrieves the descriptor of the given value
+ * parameter by name.
*/
public IDescriptor getValueDescriptor(Locale locale, String name) {
int num = getNum();
for (int i = 0; i < num; i++) {
- String param = getConfig(CONFIG_PARAM_NAME + i);
- if (param != null && param.equals(name)) {
- return new Descriptor(IDescriptor.STRING, null, null,
- getConfig(CONFIG_DISPLAY_NAME + i));
- }
+ String param = getConfig(CONFIG_PARAM_NAME + i);
+ if (param != null && param.equals(name)) {
+ return new Descriptor(IDescriptor.STRING, null,
+ null,
+ getConfig(CONFIG_DISPLAY_NAME + i));
+ }
}
return null;
}
diff --git a/pki/base/common/src/com/netscape/cms/profile/input/ImageInput.java b/pki/base/common/src/com/netscape/cms/profile/input/ImageInput.java
index 01d60475..265b958d 100644
--- a/pki/base/common/src/com/netscape/cms/profile/input/ImageInput.java
+++ b/pki/base/common/src/com/netscape/cms/profile/input/ImageInput.java
@@ -17,6 +17,7 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cms.profile.input;
+
import java.util.Locale;
import com.netscape.certsrv.apps.CMS;
@@ -29,13 +30,15 @@ import com.netscape.certsrv.property.Descriptor;
import com.netscape.certsrv.property.IDescriptor;
import com.netscape.certsrv.request.IRequest;
+
/**
- * This class implements the image input that collects a picture.
+ * This class implements the image
+ * input that collects a picture.
* <p>
- *
+ *
* @version $Revision$, $Date$
*/
-public class ImageInput extends EnrollInput implements IProfileInput {
+public class ImageInput extends EnrollInput implements IProfileInput {
public static final String IMAGE_URL = "image_url";
@@ -47,7 +50,7 @@ public class ImageInput extends EnrollInput implements IProfileInput {
* Initializes this default policy.
*/
public void init(IProfile profile, IConfigStore config)
- throws EProfileException {
+ throws EProfileException {
super.init(profile, config);
}
@@ -69,16 +72,18 @@ public class ImageInput extends EnrollInput implements IProfileInput {
* Populates the request with this policy default.
*/
public void populate(IProfileContext ctx, IRequest request)
- throws EProfileException {
+ throws EProfileException {
request.setExtData(IMAGE_URL, ctx.get(IMAGE_URL));
}
/**
- * Retrieves the descriptor of the given value parameter by name.
+ * Retrieves the descriptor of the given value
+ * parameter by name.
*/
public IDescriptor getValueDescriptor(Locale locale, String name) {
if (name.equals(IMAGE_URL)) {
- return new Descriptor(IDescriptor.STRING, null, null,
+ return new Descriptor(IDescriptor.STRING, null,
+ null,
CMS.getUserMessage(locale, "CMS_PROFILE_INPUT_IMAGE_URL"));
}
return null;
diff --git a/pki/base/common/src/com/netscape/cms/profile/input/KeyGenInput.java b/pki/base/common/src/com/netscape/cms/profile/input/KeyGenInput.java
index 37093008..00c0ffcf 100644
--- a/pki/base/common/src/com/netscape/cms/profile/input/KeyGenInput.java
+++ b/pki/base/common/src/com/netscape/cms/profile/input/KeyGenInput.java
@@ -17,6 +17,7 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cms.profile.input;
+
import java.util.Locale;
import netscape.security.pkcs.PKCS10;
@@ -37,21 +38,25 @@ import com.netscape.certsrv.property.IDescriptor;
import com.netscape.certsrv.request.IRequest;
import com.netscape.cms.profile.common.EnrollProfile;
+
/**
- * This class implements the key generation input that populates parameters to
- * the enrollment page for key generation.
+ * This class implements the key generation input that
+ * populates parameters to the enrollment page for
+ * key generation.
* <p>
- *
- * This input normally is used with user-based or non certificate request
- * profile.
+ *
+ * This input normally is used with user-based or
+ * non certificate request profile.
* <p>
- *
+ *
* @version $Revision$, $Date$
*/
-public class KeyGenInput extends EnrollInput implements IProfileInput {
+public class KeyGenInput extends EnrollInput implements IProfileInput {
- public static final String VAL_KEYGEN_REQUEST_TYPE = EnrollProfile.CTX_CERT_REQUEST_TYPE;
- public static final String VAL_KEYGEN_REQUEST = EnrollProfile.CTX_CERT_REQUEST;
+ public static final String VAL_KEYGEN_REQUEST_TYPE =
+ EnrollProfile.CTX_CERT_REQUEST_TYPE;
+ public static final String VAL_KEYGEN_REQUEST =
+ EnrollProfile.CTX_CERT_REQUEST;
public EnrollProfile mEnrollProfile = null;
@@ -64,7 +69,7 @@ public class KeyGenInput extends EnrollInput implements IProfileInput {
* Initializes this default policy.
*/
public void init(IProfile profile, IConfigStore config)
- throws EProfileException {
+ throws EProfileException {
super.init(profile, config);
mEnrollProfile = (EnrollProfile) profile;
}
@@ -87,97 +92,94 @@ public class KeyGenInput extends EnrollInput implements IProfileInput {
* Populates the request with this policy default.
*/
public void populate(IProfileContext ctx, IRequest request)
- throws EProfileException {
+ throws EProfileException {
String keygen_request_type = ctx.get(VAL_KEYGEN_REQUEST_TYPE);
String keygen_request = ctx.get(VAL_KEYGEN_REQUEST);
- X509CertInfo info = request
- .getExtDataInCertInfo(EnrollProfile.REQUEST_CERTINFO);
+ X509CertInfo info =
+ request.getExtDataInCertInfo(EnrollProfile.REQUEST_CERTINFO);
if (keygen_request_type == null) {
- CMS.debug("KeyGenInput: populate - invalid cert request type " + "");
- throw new EProfileException(CMS.getUserMessage(getLocale(request),
- "CMS_PROFILE_UNKNOWN_CERT_REQ_TYPE", ""));
+ CMS.debug("KeyGenInput: populate - invalid cert request type " +
+ "");
+ throw new EProfileException(
+ CMS.getUserMessage(getLocale(request),
+ "CMS_PROFILE_UNKNOWN_CERT_REQ_TYPE",
+ ""));
}
if (keygen_request_type.startsWith(EnrollProfile.REQ_TYPE_PKCS10)) {
- PKCS10 pkcs10 = mEnrollProfile.parsePKCS10(getLocale(request),
- keygen_request);
+ PKCS10 pkcs10 = mEnrollProfile.parsePKCS10(getLocale(request), keygen_request);
if (pkcs10 == null) {
throw new EProfileException(CMS.getUserMessage(
- getLocale(request), "CMS_PROFILE_NO_CERT_REQ"));
+ getLocale(request), "CMS_PROFILE_NO_CERT_REQ"));
}
- mEnrollProfile
- .fillPKCS10(getLocale(request), pkcs10, info, request);
- } else if (keygen_request_type
- .startsWith(EnrollProfile.REQ_TYPE_KEYGEN)) {
- DerInputStream keygen = mEnrollProfile.parseKeyGen(
- getLocale(request), keygen_request);
+ mEnrollProfile.fillPKCS10(getLocale(request), pkcs10, info, request);
+ } else if (keygen_request_type.startsWith(EnrollProfile.REQ_TYPE_KEYGEN)) {
+ DerInputStream keygen = mEnrollProfile.parseKeyGen(getLocale(request), keygen_request);
if (keygen == null) {
throw new EProfileException(CMS.getUserMessage(
- getLocale(request), "CMS_PROFILE_NO_CERT_REQ"));
+ getLocale(request), "CMS_PROFILE_NO_CERT_REQ"));
}
- mEnrollProfile
- .fillKeyGen(getLocale(request), keygen, info, request);
+ mEnrollProfile.fillKeyGen(getLocale(request), keygen, info, request);
} else if (keygen_request_type.startsWith(EnrollProfile.REQ_TYPE_CRMF)) {
- CertReqMsg msgs[] = mEnrollProfile.parseCRMF(getLocale(request),
- keygen_request);
+ CertReqMsg msgs[] = mEnrollProfile.parseCRMF(getLocale(request), keygen_request);
if (msgs == null) {
throw new EProfileException(CMS.getUserMessage(
- getLocale(request), "CMS_PROFILE_NO_CERT_REQ"));
+ getLocale(request), "CMS_PROFILE_NO_CERT_REQ"));
}
for (int x = 0; x < msgs.length; x++) {
verifyPOP(getLocale(request), msgs[x]);
}
// This profile only handle the first request in CRMF
- Integer seqNum = request
- .getExtDataInInteger(EnrollProfile.REQUEST_SEQ_NUM);
+ Integer seqNum = request.getExtDataInInteger(EnrollProfile.REQUEST_SEQ_NUM);
- mEnrollProfile.fillCertReqMsg(getLocale(request),
- msgs[seqNum.intValue()], info, request);
+ mEnrollProfile.fillCertReqMsg(getLocale(request), msgs[seqNum.intValue()], info, request);
} else if (keygen_request_type.startsWith(EnrollProfile.REQ_TYPE_CMC)) {
- TaggedRequest msgs[] = mEnrollProfile.parseCMC(getLocale(request),
- keygen_request);
+ TaggedRequest msgs[] = mEnrollProfile.parseCMC(getLocale(request), keygen_request);
if (msgs == null) {
throw new EProfileException(CMS.getUserMessage(
- getLocale(request), "CMS_PROFILE_NO_CERT_REQ"));
+ getLocale(request), "CMS_PROFILE_NO_CERT_REQ"));
}
// This profile only handle the first request in CRMF
- Integer seqNum = request
- .getExtDataInInteger(EnrollProfile.REQUEST_SEQ_NUM);
+ Integer seqNum = request.getExtDataInInteger(EnrollProfile.REQUEST_SEQ_NUM);
- if (seqNum == null) {
- throw new EProfileException(CMS.getUserMessage(
- getLocale(request), "CMS_PROFILE_UNKNOWN_SEQ_NUM"));
+ if (seqNum == null) {
+ throw new EProfileException(
+ CMS.getUserMessage(getLocale(request),
+ "CMS_PROFILE_UNKNOWN_SEQ_NUM"));
}
- mEnrollProfile.fillTaggedRequest(getLocale(request),
- msgs[seqNum.intValue()], info, request);
+ mEnrollProfile.fillTaggedRequest(getLocale(request), msgs[seqNum.intValue()], info, request);
} else {
// error
- CMS.debug("DualKeyGenInput: populate - "
- + "invalid cert request type " + keygen_request_type);
- throw new EProfileException(CMS.getUserMessage(getLocale(request),
- "CMS_PROFILE_UNKNOWN_CERT_REQ_TYPE", keygen_request_type));
+ CMS.debug("DualKeyGenInput: populate - " +
+ "invalid cert request type " + keygen_request_type);
+ throw new EProfileException(CMS.getUserMessage(
+ getLocale(request),
+ "CMS_PROFILE_UNKNOWN_CERT_REQ_TYPE",
+ keygen_request_type));
}
request.setExtData(EnrollProfile.REQUEST_CERTINFO, info);
}
/**
- * Retrieves the descriptor of the given value parameter by name.
+ * Retrieves the descriptor of the given value
+ * parameter by name.
*/
public IDescriptor getValueDescriptor(Locale locale, String name) {
if (name.equals(VAL_KEYGEN_REQUEST_TYPE)) {
- return new Descriptor(IDescriptor.KEYGEN_REQUEST_TYPE, null, null,
- CMS.getUserMessage(locale,
- "CMS_PROFILE_INPUT_KEYGEN_REQ_TYPE"));
+ return new Descriptor(IDescriptor.KEYGEN_REQUEST_TYPE, null,
+ null,
+ CMS.getUserMessage(locale, "CMS_PROFILE_INPUT_KEYGEN_REQ_TYPE"));
} else if (name.equals(VAL_KEYGEN_REQUEST)) {
- return new Descriptor(IDescriptor.KEYGEN_REQUEST, null, null,
+ return new Descriptor(IDescriptor.KEYGEN_REQUEST, null,
+ null,
CMS.getUserMessage(locale, "CMS_PROFILE_INPUT_KEYGEN_REQ"));
}
return null;
diff --git a/pki/base/common/src/com/netscape/cms/profile/input/SerialNumRenewInput.java b/pki/base/common/src/com/netscape/cms/profile/input/SerialNumRenewInput.java
index b464cdf8..dce75c15 100644
--- a/pki/base/common/src/com/netscape/cms/profile/input/SerialNumRenewInput.java
+++ b/pki/base/common/src/com/netscape/cms/profile/input/SerialNumRenewInput.java
@@ -17,6 +17,7 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cms.profile.input;
+
import java.util.Locale;
import com.netscape.certsrv.apps.CMS;
@@ -29,13 +30,15 @@ import com.netscape.certsrv.property.Descriptor;
import com.netscape.certsrv.property.IDescriptor;
import com.netscape.certsrv.request.IRequest;
+
/**
- * This class implements the serial number input for renewal
+ * This class implements the serial number input
+ * for renewal
* <p>
- *
- * @author Christina Fu
+ *
+ * @author Christina Fu
*/
-public class SerialNumRenewInput extends EnrollInput implements IProfileInput {
+public class SerialNumRenewInput extends EnrollInput implements IProfileInput {
public static final String SERIAL_NUM = "serial_num";
@@ -47,7 +50,7 @@ public class SerialNumRenewInput extends EnrollInput implements IProfileInput {
* Initializes this default policy.
*/
public void init(IProfile profile, IConfigStore config)
- throws EProfileException {
+ throws EProfileException {
super.init(profile, config);
}
@@ -69,18 +72,19 @@ public class SerialNumRenewInput extends EnrollInput implements IProfileInput {
* Populates the request with this policy default.
*/
public void populate(IProfileContext ctx, IRequest request)
- throws EProfileException {
+ throws EProfileException {
//
}
/**
- * Retrieves the descriptor of the given value parameter by name.
+ * Retrieves the descriptor of the given value
+ * parameter by name.
*/
public IDescriptor getValueDescriptor(Locale locale, String name) {
if (name.equals(SERIAL_NUM)) {
- return new Descriptor(IDescriptor.STRING, null, null,
- CMS.getUserMessage(locale,
- "CMS_PROFILE_INPUT_SERIAL_NUM_NAME"));
+ return new Descriptor(IDescriptor.STRING, null,
+ null,
+ CMS.getUserMessage(locale, "CMS_PROFILE_INPUT_SERIAL_NUM_NAME"));
}
return null;
}
diff --git a/pki/base/common/src/com/netscape/cms/profile/input/SubjectDNInput.java b/pki/base/common/src/com/netscape/cms/profile/input/SubjectDNInput.java
index d868fefd..8691b45c 100644
--- a/pki/base/common/src/com/netscape/cms/profile/input/SubjectDNInput.java
+++ b/pki/base/common/src/com/netscape/cms/profile/input/SubjectDNInput.java
@@ -17,6 +17,7 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cms.profile.input;
+
import java.util.Enumeration;
import java.util.Locale;
import java.util.Vector;
@@ -36,10 +37,11 @@ import com.netscape.certsrv.property.IDescriptor;
import com.netscape.certsrv.request.IRequest;
import com.netscape.cms.profile.common.EnrollProfile;
+
/**
* This plugin accepts subject DN from end user.
*/
-public class SubjectDNInput extends EnrollInput implements IProfileInput {
+public class SubjectDNInput extends EnrollInput implements IProfileInput {
public static final String VAL_SUBJECT = "subject";
@@ -50,7 +52,7 @@ public class SubjectDNInput extends EnrollInput implements IProfileInput {
* Initializes this default policy.
*/
public void init(IProfile profile, IConfigStore config)
- throws EProfileException {
+ throws EProfileException {
super.init(profile, config);
}
@@ -58,57 +60,58 @@ public class SubjectDNInput extends EnrollInput implements IProfileInput {
* Retrieves the localizable name of this policy.
*/
public String getName(Locale locale) {
- return CMS
- .getUserMessage(locale, "CMS_PROFILE_INPUT_SUBJECT_NAME_NAME");
+ return CMS.getUserMessage(locale, "CMS_PROFILE_INPUT_SUBJECT_NAME_NAME");
}
/**
* Retrieves the localizable description of this policy.
*/
public String getText(Locale locale) {
- return CMS
- .getUserMessage(locale, "CMS_PROFILE_INPUT_SUBJECT_NAME_TEXT");
+ return CMS.getUserMessage(locale, "CMS_PROFILE_INPUT_SUBJECT_NAME_TEXT");
}
+
public String getConfig(String name) {
- String config = super.getConfig(name);
- if (config == null || config.equals(""))
- return "true";
- return config;
+ String config = super.getConfig(name);
+ if (config == null || config.equals(""))
+ return "true";
+ return config;
}
/**
* Returns selected value names based on the configuration.
*/
public Enumeration getValueNames() {
- Vector v = new Vector();
- v.addElement(VAL_SUBJECT);
- return v.elements();
+ Vector v = new Vector();
+ v.addElement(VAL_SUBJECT);
+ return v.elements();
}
/**
* Populates the request with this policy default.
*/
public void populate(IProfileContext ctx, IRequest request)
- throws EProfileException {
- X509CertInfo info = request
- .getExtDataInCertInfo(EnrollProfile.REQUEST_CERTINFO);
+ throws EProfileException {
+ X509CertInfo info =
+ request.getExtDataInCertInfo(EnrollProfile.REQUEST_CERTINFO);
String subjectName = "";
subjectName = ctx.get(VAL_SUBJECT);
if (subjectName.equals("")) {
- throw new EProfileException(CMS.getUserMessage(getLocale(request),
- "CMS_PROFILE_SUBJECT_NAME_NOT_FOUND"));
+ throw new EProfileException(
+ CMS.getUserMessage(getLocale(request),
+ "CMS_PROFILE_SUBJECT_NAME_NOT_FOUND"));
}
X500Name name = null;
try {
name = new X500Name(subjectName);
} catch (Exception e) {
- throw new EProfileException(CMS.getUserMessage(getLocale(request),
- "CMS_PROFILE_INVALID_SUBJECT_NAME", subjectName));
+ throw new EProfileException(
+ CMS.getUserMessage(getLocale(request),
+ "CMS_PROFILE_INVALID_SUBJECT_NAME", subjectName));
}
- parseSubjectName(name, info, request);
+ parseSubjectName(name, info, request);
request.setExtData(EnrollProfile.REQUEST_CERTINFO, info);
}
@@ -117,23 +120,26 @@ public class SubjectDNInput extends EnrollInput implements IProfileInput {
}
/**
- * Retrieves the descriptor of the given value parameter by name.
+ * Retrieves the descriptor of the given value
+ * parameter by name.
*/
public IDescriptor getValueDescriptor(Locale locale, String name) {
if (name.equals(VAL_SUBJECT)) {
- return new Descriptor(IDescriptor.STRING, null, null,
+ return new Descriptor(IDescriptor.STRING, null,
+ null,
CMS.getUserMessage(locale, "CMS_PROFILE_SUBJECT_NAME"));
}
return null;
}
- protected void parseSubjectName(X500Name subj, X509CertInfo info,
- IRequest req) throws EProfileException {
+ protected void parseSubjectName(X500Name subj, X509CertInfo info, IRequest req)
+ throws EProfileException {
try {
req.setExtData(EnrollProfile.REQUEST_SUBJECT_NAME,
new CertificateSubjectName(subj));
} catch (Exception e) {
- CMS.debug("SubjectNameInput: parseSubject Name " + e.toString());
+ CMS.debug("SubjectNameInput: parseSubject Name " +
+ e.toString());
}
}
}
diff --git a/pki/base/common/src/com/netscape/cms/profile/input/SubjectNameInput.java b/pki/base/common/src/com/netscape/cms/profile/input/SubjectNameInput.java
index 5288a9c3..15f906f9 100644
--- a/pki/base/common/src/com/netscape/cms/profile/input/SubjectNameInput.java
+++ b/pki/base/common/src/com/netscape/cms/profile/input/SubjectNameInput.java
@@ -17,6 +17,7 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cms.profile.input;
+
import java.util.Enumeration;
import java.util.Locale;
import java.util.Vector;
@@ -36,18 +37,20 @@ import com.netscape.certsrv.property.IDescriptor;
import com.netscape.certsrv.request.IRequest;
import com.netscape.cms.profile.common.EnrollProfile;
+
/**
- * This class implements the subject name input that populates text fields to
- * the enrollment page so that distinguished name parameters can be collected
- * from the user.
+ * This class implements the subject name input
+ * that populates text fields to the enrollment
+ * page so that distinguished name parameters
+ * can be collected from the user.
* <p>
- * The collected parameters could be used for fomulating the subject name in the
- * certificate.
+ * The collected parameters could be used for
+ * fomulating the subject name in the certificate.
* <p>
- *
+ *
* @version $Revision$, $Date$
*/
-public class SubjectNameInput extends EnrollInput implements IProfileInput {
+public class SubjectNameInput extends EnrollInput implements IProfileInput {
public static final String CONFIG_UID = "sn_uid";
public static final String CONFIG_EMAIL = "sn_e";
@@ -85,7 +88,7 @@ public class SubjectNameInput extends EnrollInput implements IProfileInput {
* Initializes this default policy.
*/
public void init(IProfile profile, IConfigStore config)
- throws EProfileException {
+ throws EProfileException {
super.init(profile, config);
}
@@ -93,112 +96,111 @@ public class SubjectNameInput extends EnrollInput implements IProfileInput {
* Retrieves the localizable name of this policy.
*/
public String getName(Locale locale) {
- return CMS
- .getUserMessage(locale, "CMS_PROFILE_INPUT_SUBJECT_NAME_NAME");
+ return CMS.getUserMessage(locale, "CMS_PROFILE_INPUT_SUBJECT_NAME_NAME");
}
/**
* Retrieves the localizable description of this policy.
*/
public String getText(Locale locale) {
- return CMS
- .getUserMessage(locale, "CMS_PROFILE_INPUT_SUBJECT_NAME_TEXT");
+ return CMS.getUserMessage(locale, "CMS_PROFILE_INPUT_SUBJECT_NAME_TEXT");
}
+
public String getConfig(String name) {
- String config = super.getConfig(name);
- if (config == null || config.equals(""))
- return "true";
- return config;
+ String config = super.getConfig(name);
+ if (config == null || config.equals(""))
+ return "true";
+ return config;
}
/**
* Returns selected value names based on the configuration.
*/
public Enumeration getValueNames() {
- Vector v = new Vector();
- String c_uid = getConfig(CONFIG_UID);
- if (c_uid == null || c_uid.equals("")) {
- v.addElement(VAL_UID); // default case
- } else {
- if (c_uid.equals("true")) {
- v.addElement(VAL_UID);
- }
- }
- String c_email = getConfig(CONFIG_EMAIL);
- if (c_email == null || c_email.equals("")) {
- v.addElement(VAL_EMAIL);
- } else {
- if (c_email.equals("true")) {
- v.addElement(VAL_EMAIL);
- }
- }
- String c_cn = getConfig(CONFIG_CN);
- if (c_cn == null || c_cn.equals("")) {
- v.addElement(VAL_CN);
- } else {
- if (c_cn.equals("true")) {
- v.addElement(VAL_CN);
- }
- }
- String c_ou3 = getConfig(CONFIG_OU3);
- if (c_ou3 == null || c_ou3.equals("")) {
- v.addElement(VAL_OU3);
- } else {
- if (c_ou3.equals("true")) {
- v.addElement(VAL_OU3);
- }
- }
- String c_ou2 = getConfig(CONFIG_OU2);
- if (c_ou2 == null || c_ou2.equals("")) {
- v.addElement(VAL_OU2);
- } else {
- if (c_ou2.equals("true")) {
- v.addElement(VAL_OU2);
- }
- }
- String c_ou1 = getConfig(CONFIG_OU1);
- if (c_ou1 == null || c_ou1.equals("")) {
- v.addElement(VAL_OU1);
- } else {
- if (c_ou1.equals("true")) {
- v.addElement(VAL_OU1);
- }
- }
- String c_ou = getConfig(CONFIG_OU);
- if (c_ou == null || c_ou.equals("")) {
- v.addElement(VAL_OU);
- } else {
- if (c_ou.equals("true")) {
- v.addElement(VAL_OU);
- }
- }
- String c_o = getConfig(CONFIG_O);
- if (c_o == null || c_o.equals("")) {
- v.addElement(VAL_O);
- } else {
- if (c_o.equals("true")) {
- v.addElement(VAL_O);
- }
- }
- String c_c = getConfig(CONFIG_C);
- if (c_c == null || c_c.equals("")) {
- v.addElement(VAL_C);
- } else {
- if (c_c.equals("true")) {
- v.addElement(VAL_C);
- }
- }
- return v.elements();
+ Vector v = new Vector();
+ String c_uid = getConfig(CONFIG_UID);
+ if (c_uid == null || c_uid.equals("")) {
+ v.addElement(VAL_UID); // default case
+ } else {
+ if (c_uid.equals("true")) {
+ v.addElement(VAL_UID);
+ }
+ }
+ String c_email = getConfig(CONFIG_EMAIL);
+ if (c_email == null || c_email.equals("")) {
+ v.addElement(VAL_EMAIL);
+ } else {
+ if (c_email.equals("true")) {
+ v.addElement(VAL_EMAIL);
+ }
+ }
+ String c_cn = getConfig(CONFIG_CN);
+ if (c_cn == null || c_cn.equals("")) {
+ v.addElement(VAL_CN);
+ } else {
+ if (c_cn.equals("true")) {
+ v.addElement(VAL_CN);
+ }
+ }
+ String c_ou3 = getConfig(CONFIG_OU3);
+ if (c_ou3 == null || c_ou3.equals("")) {
+ v.addElement(VAL_OU3);
+ } else {
+ if (c_ou3.equals("true")) {
+ v.addElement(VAL_OU3);
+ }
+ }
+ String c_ou2 = getConfig(CONFIG_OU2);
+ if (c_ou2 == null || c_ou2.equals("")) {
+ v.addElement(VAL_OU2);
+ } else {
+ if (c_ou2.equals("true")) {
+ v.addElement(VAL_OU2);
+ }
+ }
+ String c_ou1 = getConfig(CONFIG_OU1);
+ if (c_ou1 == null || c_ou1.equals("")) {
+ v.addElement(VAL_OU1);
+ } else {
+ if (c_ou1.equals("true")) {
+ v.addElement(VAL_OU1);
+ }
+ }
+ String c_ou = getConfig(CONFIG_OU);
+ if (c_ou == null || c_ou.equals("")) {
+ v.addElement(VAL_OU);
+ } else {
+ if (c_ou.equals("true")) {
+ v.addElement(VAL_OU);
+ }
+ }
+ String c_o = getConfig(CONFIG_O);
+ if (c_o == null || c_o.equals("")) {
+ v.addElement(VAL_O);
+ } else {
+ if (c_o.equals("true")) {
+ v.addElement(VAL_O);
+ }
+ }
+ String c_c = getConfig(CONFIG_C);
+ if (c_c == null || c_c.equals("")) {
+ v.addElement(VAL_C);
+ } else {
+ if (c_c.equals("true")) {
+ v.addElement(VAL_C);
+ }
+ }
+ return v.elements();
}
/**
* Populates the request with this policy default.
*/
public void populate(IProfileContext ctx, IRequest request)
- throws EProfileException {
- X509CertInfo info = request
- .getExtDataInCertInfo(EnrollProfile.REQUEST_CERTINFO);
+ throws EProfileException {
+ X509CertInfo info =
+ request.getExtDataInCertInfo(EnrollProfile.REQUEST_CERTINFO);
String subjectName = "";
String uid = ctx.get(VAL_UID);
@@ -267,48 +269,59 @@ public class SubjectNameInput extends EnrollInput implements IProfileInput {
subjectName += "C=" + c;
}
if (subjectName.equals("")) {
- throw new EProfileException(CMS.getUserMessage(getLocale(request),
- "CMS_PROFILE_SUBJECT_NAME_NOT_FOUND"));
+ throw new EProfileException(
+ CMS.getUserMessage(getLocale(request),
+ "CMS_PROFILE_SUBJECT_NAME_NOT_FOUND"));
}
X500Name name = null;
try {
name = new X500Name(subjectName);
} catch (Exception e) {
- throw new EProfileException(CMS.getUserMessage(getLocale(request),
- "CMS_PROFILE_INVALID_SUBJECT_NAME", subjectName));
+ throw new EProfileException(
+ CMS.getUserMessage(getLocale(request),
+ "CMS_PROFILE_INVALID_SUBJECT_NAME", subjectName));
}
- parseSubjectName(name, info, request);
+ parseSubjectName(name, info, request);
request.setExtData(EnrollProfile.REQUEST_CERTINFO, info);
}
public IDescriptor getConfigDescriptor(Locale locale, String name) {
if (name.equals(CONFIG_UID)) {
- return new Descriptor(IDescriptor.BOOLEAN, null, "true",
+ return new Descriptor(IDescriptor.BOOLEAN, null,
+ "true",
CMS.getUserMessage(locale, "CMS_PROFILE_SN_UID"));
} else if (name.equals(CONFIG_EMAIL)) {
- return new Descriptor(IDescriptor.BOOLEAN, null, "true",
+ return new Descriptor(IDescriptor.BOOLEAN, null,
+ "true",
CMS.getUserMessage(locale, "CMS_PROFILE_SN_UID"));
} else if (name.equals(CONFIG_CN)) {
- return new Descriptor(IDescriptor.BOOLEAN, null, "true",
+ return new Descriptor(IDescriptor.BOOLEAN, null,
+ "true",
CMS.getUserMessage(locale, "CMS_PROFILE_SN_CN"));
} else if (name.equals(CONFIG_OU3)) {
- return new Descriptor(IDescriptor.BOOLEAN, null, "true",
+ return new Descriptor(IDescriptor.BOOLEAN, null,
+ "true",
CMS.getUserMessage(locale, "CMS_PROFILE_SN_OU"));
} else if (name.equals(CONFIG_OU2)) {
- return new Descriptor(IDescriptor.BOOLEAN, null, "true",
+ return new Descriptor(IDescriptor.BOOLEAN, null,
+ "true",
CMS.getUserMessage(locale, "CMS_PROFILE_SN_OU"));
} else if (name.equals(CONFIG_OU1)) {
- return new Descriptor(IDescriptor.BOOLEAN, null, "true",
+ return new Descriptor(IDescriptor.BOOLEAN, null,
+ "true",
CMS.getUserMessage(locale, "CMS_PROFILE_SN_OU"));
} else if (name.equals(CONFIG_OU)) {
- return new Descriptor(IDescriptor.BOOLEAN, null, "true",
+ return new Descriptor(IDescriptor.BOOLEAN, null,
+ "true",
CMS.getUserMessage(locale, "CMS_PROFILE_SN_OU"));
} else if (name.equals(CONFIG_O)) {
- return new Descriptor(IDescriptor.BOOLEAN, null, "true",
+ return new Descriptor(IDescriptor.BOOLEAN, null,
+ "true",
CMS.getUserMessage(locale, "CMS_PROFILE_SN_O"));
} else if (name.equals(CONFIG_C)) {
- return new Descriptor(IDescriptor.BOOLEAN, null, "true",
+ return new Descriptor(IDescriptor.BOOLEAN, null,
+ "true",
CMS.getUserMessage(locale, "CMS_PROFILE_SN_C"));
} else {
return null;
@@ -316,47 +329,58 @@ public class SubjectNameInput extends EnrollInput implements IProfileInput {
}
/**
- * Retrieves the descriptor of the given value parameter by name.
+ * Retrieves the descriptor of the given value
+ * parameter by name.
*/
public IDescriptor getValueDescriptor(Locale locale, String name) {
if (name.equals(VAL_UID)) {
- return new Descriptor(IDescriptor.STRING, null, null,
+ return new Descriptor(IDescriptor.STRING, null,
+ null,
CMS.getUserMessage(locale, "CMS_PROFILE_SN_UID"));
} else if (name.equals(VAL_EMAIL)) {
- return new Descriptor(IDescriptor.STRING, null, null,
+ return new Descriptor(IDescriptor.STRING, null,
+ null,
CMS.getUserMessage(locale, "CMS_PROFILE_SN_EMAIL"));
} else if (name.equals(VAL_CN)) {
- return new Descriptor(IDescriptor.STRING, null, null,
+ return new Descriptor(IDescriptor.STRING, null,
+ null,
CMS.getUserMessage(locale, "CMS_PROFILE_SN_CN"));
} else if (name.equals(VAL_OU3)) {
- return new Descriptor(IDescriptor.STRING, null, null,
+ return new Descriptor(IDescriptor.STRING, null,
+ null,
CMS.getUserMessage(locale, "CMS_PROFILE_SN_OU") + " 3");
} else if (name.equals(VAL_OU2)) {
- return new Descriptor(IDescriptor.STRING, null, null,
+ return new Descriptor(IDescriptor.STRING, null,
+ null,
CMS.getUserMessage(locale, "CMS_PROFILE_SN_OU") + " 2");
} else if (name.equals(VAL_OU1)) {
- return new Descriptor(IDescriptor.STRING, null, null,
+ return new Descriptor(IDescriptor.STRING, null,
+ null,
CMS.getUserMessage(locale, "CMS_PROFILE_SN_OU") + " 1");
} else if (name.equals(VAL_OU)) {
- return new Descriptor(IDescriptor.STRING, null, null,
+ return new Descriptor(IDescriptor.STRING, null,
+ null,
CMS.getUserMessage(locale, "CMS_PROFILE_SN_OU"));
} else if (name.equals(VAL_O)) {
- return new Descriptor(IDescriptor.STRING, null, null,
+ return new Descriptor(IDescriptor.STRING, null,
+ null,
CMS.getUserMessage(locale, "CMS_PROFILE_SN_O"));
} else if (name.equals(VAL_C)) {
- return new Descriptor(IDescriptor.STRING, null, null,
+ return new Descriptor(IDescriptor.STRING, null,
+ null,
CMS.getUserMessage(locale, "CMS_PROFILE_SN_C"));
}
return null;
}
- protected void parseSubjectName(X500Name subj, X509CertInfo info,
- IRequest req) throws EProfileException {
+ protected void parseSubjectName(X500Name subj, X509CertInfo info, IRequest req)
+ throws EProfileException {
try {
req.setExtData(EnrollProfile.REQUEST_SUBJECT_NAME,
new CertificateSubjectName(subj));
} catch (Exception e) {
- CMS.debug("SubjectNameInput: parseSubject Name " + e.toString());
+ CMS.debug("SubjectNameInput: parseSubject Name " +
+ e.toString());
}
}
}
diff --git a/pki/base/common/src/com/netscape/cms/profile/input/SubmitterInfoInput.java b/pki/base/common/src/com/netscape/cms/profile/input/SubmitterInfoInput.java
index f45a0c38..52df2d41 100644
--- a/pki/base/common/src/com/netscape/cms/profile/input/SubmitterInfoInput.java
+++ b/pki/base/common/src/com/netscape/cms/profile/input/SubmitterInfoInput.java
@@ -17,6 +17,7 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cms.profile.input;
+
import java.util.Locale;
import com.netscape.certsrv.apps.CMS;
@@ -29,14 +30,16 @@ import com.netscape.certsrv.property.Descriptor;
import com.netscape.certsrv.property.IDescriptor;
import com.netscape.certsrv.request.IRequest;
+
/**
- * This class implements the submitter information input that collects
- * certificate requestor's information such as name, email and phone.
+ * This class implements the submitter information
+ * input that collects certificate requestor's
+ * information such as name, email and phone.
* <p>
- *
+ *
* @version $Revision$, $Date$
*/
-public class SubmitterInfoInput extends EnrollInput implements IProfileInput {
+public class SubmitterInfoInput extends EnrollInput implements IProfileInput {
public static final String NAME = "requestor_name";
public static final String EMAIL = "requestor_email";
@@ -52,7 +55,7 @@ public class SubmitterInfoInput extends EnrollInput implements IProfileInput {
* Initializes this default policy.
*/
public void init(IProfile profile, IConfigStore config)
- throws EProfileException {
+ throws EProfileException {
super.init(profile, config);
}
@@ -74,22 +77,26 @@ public class SubmitterInfoInput extends EnrollInput implements IProfileInput {
* Populates the request with this policy default.
*/
public void populate(IProfileContext ctx, IRequest request)
- throws EProfileException {
+ throws EProfileException {
//
}
/**
- * Retrieves the descriptor of the given value parameter by name.
+ * Retrieves the descriptor of the given value
+ * parameter by name.
*/
public IDescriptor getValueDescriptor(Locale locale, String name) {
if (name.equals(NAME)) {
- return new Descriptor(IDescriptor.STRING, null, null,
+ return new Descriptor(IDescriptor.STRING, null,
+ null,
CMS.getUserMessage(locale, "CMS_PROFILE_REQUESTOR_NAME"));
} else if (name.equals(EMAIL)) {
- return new Descriptor(IDescriptor.STRING, null, null,
+ return new Descriptor(IDescriptor.STRING, null,
+ null,
CMS.getUserMessage(locale, "CMS_PROFILE_REQUESTOR_EMAIL"));
} else if (name.equals(PHONE)) {
- return new Descriptor(IDescriptor.STRING, null, null,
+ return new Descriptor(IDescriptor.STRING, null,
+ null,
CMS.getUserMessage(locale, "CMS_PROFILE_REQUESTOR_PHONE"));
}
return null;
diff --git a/pki/base/common/src/com/netscape/cms/profile/input/nsHKeyCertReqInput.java b/pki/base/common/src/com/netscape/cms/profile/input/nsHKeyCertReqInput.java
index 4b46f3c6..64988fed 100644
--- a/pki/base/common/src/com/netscape/cms/profile/input/nsHKeyCertReqInput.java
+++ b/pki/base/common/src/com/netscape/cms/profile/input/nsHKeyCertReqInput.java
@@ -17,6 +17,7 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cms.profile.input;
+
import java.util.Locale;
import netscape.security.x509.X509CertInfo;
@@ -32,17 +33,19 @@ import com.netscape.certsrv.property.IDescriptor;
import com.netscape.certsrv.request.IRequest;
import com.netscape.cms.profile.common.EnrollProfile;
+
/**
- * This class implements the certificate request input from TPS. This input
- * populates 2 main fields to the enrollment "page": 1/ token cuid, 2/ publickey
+ * This class implements the certificate request input from TPS.
+ * This input populates 2 main fields to the enrollment "page":
+ * 1/ token cuid, 2/ publickey
* <p>
*
- * This input usually is used by an enrollment profile for certificate requests
- * coming from TPS.
- *
+ * This input usually is used by an enrollment profile for
+ * certificate requests coming from TPS.
+ *
* @version $Revision$, $Date$
*/
-public class nsHKeyCertReqInput extends EnrollInput implements IProfileInput {
+public class nsHKeyCertReqInput extends EnrollInput implements IProfileInput {
public static final String VAL_TOKEN_CUID = "tokencuid";
public static final String VAL_PUBLIC_KEY = "publickey";
@@ -57,7 +60,7 @@ public class nsHKeyCertReqInput extends EnrollInput implements IProfileInput {
* Initializes this default policy.
*/
public void init(IProfile profile, IConfigStore config)
- throws EProfileException {
+ throws EProfileException {
super.init(profile, config);
mEnrollProfile = (EnrollProfile) profile;
@@ -67,86 +70,94 @@ public class nsHKeyCertReqInput extends EnrollInput implements IProfileInput {
* Retrieves the localizable name of this policy.
*/
public String getName(Locale locale) {
- return CMS.getUserMessage(locale,
- "CMS_PROFILE_INPUT_TOKENKEY_CERT_REQ_NAME");
+ return CMS.getUserMessage(locale, "CMS_PROFILE_INPUT_TOKENKEY_CERT_REQ_NAME");
}
/**
* Retrieves the localizable description of this policy.
*/
public String getText(Locale locale) {
- return CMS.getUserMessage(locale,
- "CMS_PROFILE_INPUT_TOKENKEY_CERT_REQ_TEXT");
+ return CMS.getUserMessage(locale, "CMS_PROFILE_INPUT_TOKENKEY_CERT_REQ_TEXT");
}
- /*
- * Pretty print token cuid
- */
- public String toPrettyPrint(String cuid) {
- if (cuid == null)
- return null;
-
- if (cuid.length() != 20)
- return null;
-
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < cuid.length(); i++) {
- if (i == 4 || i == 8 || i == 12 || i == 16) {
- sb.append("-");
- }
- sb.append(cuid.charAt(i));
- }
- return sb.toString();
- }
+ /*
+ * Pretty print token cuid
+ */
+ public String toPrettyPrint(String cuid)
+ {
+ if (cuid == null)
+ return null;
+
+ if (cuid.length() != 20)
+ return null;
+
+ StringBuffer sb = new StringBuffer();
+ for (int i=0; i < cuid.length(); i++) {
+ if (i == 4 || i == 8 || i == 12 || i == 16) {
+ sb.append("-");
+ }
+ sb.append(cuid.charAt(i));
+ }
+ return sb.toString();
+ }
/**
* Populates the request with this policy default.
*/
public void populate(IProfileContext ctx, IRequest request)
- throws EProfileException {
+ throws EProfileException {
String tcuid = ctx.get(VAL_TOKEN_CUID);
- // pretty print tcuid
- String prettyPrintCuid = toPrettyPrint(tcuid);
- if (prettyPrintCuid == null) {
- throw new EProfileException(CMS.getUserMessage(getLocale(request),
- "CMS_PROFILE_TOKENKEY_NO_TOKENCUID", ""));
- }
+ // pretty print tcuid
+ String prettyPrintCuid = toPrettyPrint(tcuid);
+ if (prettyPrintCuid == null) {
+ throw new EProfileException(
+ CMS.getUserMessage(getLocale(request),
+ "CMS_PROFILE_TOKENKEY_NO_TOKENCUID",
+ ""));
+ }
- request.setExtData("pretty_print_tokencuid", prettyPrintCuid);
+ request.setExtData("pretty_print_tokencuid", prettyPrintCuid);
String pk = ctx.get(VAL_PUBLIC_KEY);
- X509CertInfo info = request
- .getExtDataInCertInfo(EnrollProfile.REQUEST_CERTINFO);
+ X509CertInfo info =
+ request.getExtDataInCertInfo(EnrollProfile.REQUEST_CERTINFO);
if (tcuid == null) {
- CMS.debug("nsHKeyCertReqInput: populate - tokencuid not found "
- + "");
- throw new EProfileException(CMS.getUserMessage(getLocale(request),
- "CMS_PROFILE_TOKENKEY_NO_TOKENCUID", ""));
+ CMS.debug("nsHKeyCertReqInput: populate - tokencuid not found " +
+ "");
+ throw new EProfileException(
+ CMS.getUserMessage(getLocale(request),
+ "CMS_PROFILE_TOKENKEY_NO_TOKENCUID",
+ ""));
}
if (pk == null) {
- CMS.debug("nsHKeyCertReqInput: populate - public key not found "
- + "");
- throw new EProfileException(CMS.getUserMessage(getLocale(request),
- "CMS_PROFILE_TOKENKEY_NO_PUBLIC_KEY", ""));
+ CMS.debug("nsHKeyCertReqInput: populate - public key not found " +
+ "");
+ throw new EProfileException(
+ CMS.getUserMessage(getLocale(request),
+ "CMS_PROFILE_TOKENKEY_NO_PUBLIC_KEY",
+ ""));
}
- mEnrollProfile.fillNSHKEY(getLocale(request), tcuid, pk, info, request);
+ mEnrollProfile.fillNSHKEY(getLocale(request), tcuid, pk, info, request);
request.setExtData(EnrollProfile.REQUEST_CERTINFO, info);
}
/**
- * Retrieves the descriptor of the given value parameter by name.
+ * Retrieves the descriptor of the given value
+ * parameter by name.
*/
public IDescriptor getValueDescriptor(Locale locale, String name) {
if (name.equals(VAL_TOKEN_CUID)) {
- return new Descriptor(IDescriptor.STRING, null, null,
+ return new Descriptor(IDescriptor.STRING, null,
+ null,
CMS.getUserMessage(locale,
- "CMS_PROFILE_INPUT_TOKENKEY_CERT_REQ_TOKEN_CUID"));
+ "CMS_PROFILE_INPUT_TOKENKEY_CERT_REQ_TOKEN_CUID"));
} else if (name.equals(VAL_PUBLIC_KEY)) {
- return new Descriptor(IDescriptor.STRING, null, null,
+ return new Descriptor(IDescriptor.STRING, null,
+ null,
CMS.getUserMessage(locale,
- "CMS_PROFILE_INPUT_TOKENKEY_CERT_REQ_PK"));
+ "CMS_PROFILE_INPUT_TOKENKEY_CERT_REQ_PK"));
}
return null;
}
diff --git a/pki/base/common/src/com/netscape/cms/profile/input/nsNKeyCertReqInput.java b/pki/base/common/src/com/netscape/cms/profile/input/nsNKeyCertReqInput.java
index 3c80835c..58984c6c 100644
--- a/pki/base/common/src/com/netscape/cms/profile/input/nsNKeyCertReqInput.java
+++ b/pki/base/common/src/com/netscape/cms/profile/input/nsNKeyCertReqInput.java
@@ -17,6 +17,7 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cms.profile.input;
+
import java.util.Locale;
import netscape.security.x509.X509CertInfo;
@@ -32,17 +33,19 @@ import com.netscape.certsrv.property.IDescriptor;
import com.netscape.certsrv.request.IRequest;
import com.netscape.cms.profile.common.EnrollProfile;
+
/**
- * This class implements the certificate request input from TPS. This input
- * populates 2 main fields to the enrollment "page": 1/ id, 2/ publickey
+ * This class implements the certificate request input from TPS.
+ * This input populates 2 main fields to the enrollment "page":
+ * 1/ id, 2/ publickey
* <p>
*
- * This input usually is used by an enrollment profile for certificate requests
- * coming from TPS.
- *
+ * This input usually is used by an enrollment profile for
+ * certificate requests coming from TPS.
+ *
* @version $Revision$, $Date$
*/
-public class nsNKeyCertReqInput extends EnrollInput implements IProfileInput {
+public class nsNKeyCertReqInput extends EnrollInput implements IProfileInput {
public static final String VAL_SN = "screenname";
public static final String VAL_PUBLIC_KEY = "publickey";
@@ -57,7 +60,7 @@ public class nsNKeyCertReqInput extends EnrollInput implements IProfileInput {
* Initializes this default policy.
*/
public void init(IProfile profile, IConfigStore config)
- throws EProfileException {
+ throws EProfileException {
super.init(profile, config);
mEnrollProfile = (EnrollProfile) profile;
@@ -67,56 +70,62 @@ public class nsNKeyCertReqInput extends EnrollInput implements IProfileInput {
* Retrieves the localizable name of this policy.
*/
public String getName(Locale locale) {
- return CMS.getUserMessage(locale,
- "CMS_PROFILE_INPUT_TOKENKEY_CERT_REQ_NAME");
+ return CMS.getUserMessage(locale, "CMS_PROFILE_INPUT_TOKENKEY_CERT_REQ_NAME");
}
/**
* Retrieves the localizable description of this policy.
*/
public String getText(Locale locale) {
- return CMS.getUserMessage(locale,
- "CMS_PROFILE_INPUT_TOKENKEY_CERT_REQ_TEXT");
+ return CMS.getUserMessage(locale, "CMS_PROFILE_INPUT_TOKENKEY_CERT_REQ_TEXT");
}
/**
* Populates the request with this policy default.
*/
public void populate(IProfileContext ctx, IRequest request)
- throws EProfileException {
+ throws EProfileException {
String sn = ctx.get(VAL_SN);
String pk = ctx.get(VAL_PUBLIC_KEY);
- X509CertInfo info = request
- .getExtDataInCertInfo(EnrollProfile.REQUEST_CERTINFO);
+ X509CertInfo info =
+ request.getExtDataInCertInfo(EnrollProfile.REQUEST_CERTINFO);
if (sn == null) {
- CMS.debug("nsNKeyCertReqInput: populate - id not found " + "");
- throw new EProfileException(CMS.getUserMessage(getLocale(request),
- "CMS_PROFILE_TOKENKEY_NO_ID", ""));
+ CMS.debug("nsNKeyCertReqInput: populate - id not found " +
+ "");
+ throw new EProfileException(
+ CMS.getUserMessage(getLocale(request),
+ "CMS_PROFILE_TOKENKEY_NO_ID",
+ ""));
}
if (pk == null) {
- CMS.debug("nsNKeyCertReqInput: populate - public key not found "
- + "");
- throw new EProfileException(CMS.getUserMessage(getLocale(request),
- "CMS_PROFILE_TOKENKEY_NO_PUBLIC_KEY", ""));
+ CMS.debug("nsNKeyCertReqInput: populate - public key not found " +
+ "");
+ throw new EProfileException(
+ CMS.getUserMessage(getLocale(request),
+ "CMS_PROFILE_TOKENKEY_NO_PUBLIC_KEY",
+ ""));
}
- mEnrollProfile.fillNSNKEY(getLocale(request), sn, pk, info, request);
+ mEnrollProfile.fillNSNKEY(getLocale(request), sn, pk, info, request);
request.setExtData(EnrollProfile.REQUEST_CERTINFO, info);
}
/**
- * Retrieves the descriptor of the given value parameter by name.
+ * Retrieves the descriptor of the given value
+ * parameter by name.
*/
public IDescriptor getValueDescriptor(Locale locale, String name) {
if (name.equals(VAL_SN)) {
- return new Descriptor(IDescriptor.STRING, null, null,
+ return new Descriptor(IDescriptor.STRING, null,
+ null,
CMS.getUserMessage(locale,
- "CMS_PROFILE_INPUT_TOKENKEY_CERT_REQ_UID"));
+ "CMS_PROFILE_INPUT_TOKENKEY_CERT_REQ_UID"));
} else if (name.equals(VAL_PUBLIC_KEY)) {
- return new Descriptor(IDescriptor.STRING, null, null,
+ return new Descriptor(IDescriptor.STRING, null,
+ null,
CMS.getUserMessage(locale,
- "CMS_PROFILE_INPUT_TOKENKEY_CERT_REQ_PK"));
+ "CMS_PROFILE_INPUT_TOKENKEY_CERT_REQ_PK"));
}
return null;
}