diff options
author | Endi Sukma Dewata <edewata@redhat.com> | 2012-03-28 00:36:32 -0500 |
---|---|---|
committer | Endi Sukma Dewata <edewata@redhat.com> | 2012-03-28 13:19:26 -0500 |
commit | 1c8437891cdfe5580e09c495f79d81334ed0c2c0 (patch) | |
tree | 5a3ca8c31ca13c2809cccd3ac73c5791fe491163 /base/common/src/com/netscape/cms | |
parent | e744c37ab1510f87ed4b5b3eafeb3758f1d0e30f (diff) | |
download | pki-1c8437891cdfe5580e09c495f79d81334ed0c2c0.tar.gz pki-1c8437891cdfe5580e09c495f79d81334ed0c2c0.tar.xz pki-1c8437891cdfe5580e09c495f79d81334ed0c2c0.zip |
Replaced deprecated AlgorithmId.getAlgorithmId().
The deprecated getAlgorithmId() method in AlgorithmId has been replaced
with get().
Ticket #3
Diffstat (limited to 'base/common/src/com/netscape/cms')
3 files changed, 42 insertions, 47 deletions
diff --git a/base/common/src/com/netscape/cms/profile/common/EnrollProfile.java b/base/common/src/com/netscape/cms/profile/common/EnrollProfile.java index d574f0f94..6fbdddb69 100644 --- a/base/common/src/com/netscape/cms/profile/common/EnrollProfile.java +++ b/base/common/src/com/netscape/cms/profile/common/EnrollProfile.java @@ -100,7 +100,7 @@ import com.netscape.cmsutil.util.HMACDigest; /** * This class implements a generic enrollment profile. - * + * * @version $Revision$, $Date$ */ public abstract class EnrollProfile extends BasicProfile @@ -167,7 +167,7 @@ public abstract class EnrollProfile extends BasicProfile num_requests = msgs.length; } - // only 1 request for renewal + // only 1 request for renewal if ((is_renewal != null) && (is_renewal.equals("true"))) { num_requests = 1; String renewal_seq_num_str = ctx.get(CTX_RENEWAL_SEQ_NUM); @@ -229,8 +229,7 @@ public abstract class EnrollProfile extends BasicProfile info.set(X509CertInfo.VALIDITY, new CertificateValidity(new Date(), new Date())); info.set(X509CertInfo.ALGORITHM_ID, - new CertificateAlgorithmId( - AlgorithmId.getAlgorithmId("MD5withRSA"))); + new CertificateAlgorithmId(AlgorithmId.get("MD5withRSA"))); // add default extension container info.set(X509CertInfo.EXTENSIONS, @@ -281,7 +280,7 @@ public abstract class EnrollProfile extends BasicProfile Enumeration<String> setIds = getProfilePolicySetIds(); while (setIds.hasMoreElements()) { - String setId = (String) setIds.nextElement(); + String setId = setIds.nextElement(); if (count == seq_no) { return setId; @@ -323,8 +322,7 @@ public abstract class EnrollProfile extends BasicProfile // } // } - IAuthority authority = (IAuthority) - getAuthority(); + IAuthority authority = getAuthority(); IRequestQueue queue = authority.getRequestQueue(); // this profile queues request that is authenticated @@ -376,7 +374,7 @@ public abstract class EnrollProfile extends BasicProfile org.mozilla.jss.pkix.cms.ContentInfo cmcReq = (org.mozilla.jss.pkix.cms.ContentInfo) org.mozilla.jss.pkix.cms.ContentInfo.getTemplate().decode(cmcBlobIn); - org.mozilla.jss.pkix.cms.SignedData cmcFullReq = + org.mozilla.jss.pkix.cms.SignedData cmcFullReq = (org.mozilla.jss.pkix.cms.SignedData) cmcReq.getInterpretedContent(); org.mozilla.jss.pkix.cms.EncapsulatedContentInfo ci = cmcFullReq.getContentInfo(); OCTET_STRING content = ci.getContent(); @@ -1056,8 +1054,7 @@ public abstract class EnrollProfile extends BasicProfile PKCS10Attributes p10Attrs = pkcs10.getAttributes(); if (p10Attrs != null) { - PKCS10Attribute p10Attr = (PKCS10Attribute) - (p10Attrs.getAttribute(CertificateExtensions.NAME)); + PKCS10Attribute p10Attr = p10Attrs.getAttribute(CertificateExtensions.NAME); if (p10Attr != null && p10Attr.getAttributeId().equals( PKCS9Attribute.EXTENSION_REQUEST_OID)) { CMS.debug("Found PKCS10 extension"); @@ -1237,16 +1234,16 @@ public abstract class EnrollProfile extends BasicProfile /** * Populate input * <P> - * + * * (either all "agent" profile cert requests NOT made through a connector, or all "EE" profile cert requests NOT * made through a connector) * <P> - * + * * <ul> * <li>signed.audit LOGGING_SIGNED_AUDIT_PROFILE_CERT_REQUEST used when a profile cert request is made (before * approval process) * </ul> - * + * * @param ctx profile context * @param request the certificate request * @exception EProfileException an error related to this profile has @@ -1357,12 +1354,12 @@ public abstract class EnrollProfile extends BasicProfile /** * Signed Audit Log Requester ID - * + * * This method is inherited by all extended "EnrollProfile"s, * and is called to obtain the "RequesterID" for * a signed audit log message. * <P> - * + * * @param request the actual request * @return id string containing the signed audit log message RequesterID */ @@ -1388,12 +1385,12 @@ public abstract class EnrollProfile extends BasicProfile /** * Signed Audit Log Profile ID - * + * * This method is inherited by all extended "EnrollProfile"s, * and is called to obtain the "ProfileID" for * a signed audit log message. * <P> - * + * * @return id string containing the signed audit log message ProfileID */ protected String auditProfileID() { diff --git a/base/common/src/com/netscape/cms/profile/def/SigningAlgDefault.java b/base/common/src/com/netscape/cms/profile/def/SigningAlgDefault.java index 11da93fc8..81ad58c73 100644 --- a/base/common/src/com/netscape/cms/profile/def/SigningAlgDefault.java +++ b/base/common/src/com/netscape/cms/profile/def/SigningAlgDefault.java @@ -37,7 +37,7 @@ import com.netscape.certsrv.request.IRequest; * This class implements an enrollment default policy * that populates a signing algorithm * into the certificate template. - * + * * @version $Revision$, $Date$ */ public class SigningAlgDefault extends EnrollDefault { @@ -121,7 +121,7 @@ public class SigningAlgDefault extends EnrollDefault { try { info.set(X509CertInfo.ALGORITHM_ID, new CertificateAlgorithmId( - AlgorithmId.getAlgorithmId(value))); + AlgorithmId.get(value))); } catch (Exception e) { CMS.debug("SigningAlgDefault: setValue " + e.toString()); throw new EPropertyException(CMS.getUserMessage( @@ -174,8 +174,7 @@ public class SigningAlgDefault extends EnrollDefault { throws EProfileException { try { info.set(X509CertInfo.ALGORITHM_ID, - new CertificateAlgorithmId( - AlgorithmId.getAlgorithmId(getSigningAlg()))); + new CertificateAlgorithmId(AlgorithmId.get(getSigningAlg()))); } catch (Exception e) { CMS.debug("SigningAlgDefault: populate " + e.toString()); } diff --git a/base/common/src/com/netscape/cms/servlet/request/ProcessCertReq.java b/base/common/src/com/netscape/cms/servlet/request/ProcessCertReq.java index 820e9a654..c324e4a1f 100644 --- a/base/common/src/com/netscape/cms/servlet/request/ProcessCertReq.java +++ b/base/common/src/com/netscape/cms/servlet/request/ProcessCertReq.java @@ -84,7 +84,7 @@ import com.netscape.cmsutil.util.Utils; * Agent operations on Certificate requests. This servlet is used * by an Agent to approve, reject, reassign, or change a certificate * request. - * + * * @version $Revision$, $Date$ */ public class ProcessCertReq extends CMSServlet { @@ -190,7 +190,7 @@ public class ProcessCertReq extends CMSServlet { /** * initialize the servlet. This servlet uses the template file * "processCertReq.template" to process the response. - * + * * @param sc servlet configuration, read from the web.xml file */ public void init(ServletConfig sc) throws ServletException { @@ -219,7 +219,7 @@ public class ProcessCertReq extends CMSServlet { mParser = CertReqParser.DETAIL_PARSER; - // override success and error templates to null - + // override success and error templates to null - // handle templates locally. mTemplates.remove(CMSRequest.SUCCESS); @@ -255,7 +255,7 @@ public class ProcessCertReq extends CMSServlet { * <li>http.param addExts base-64, DER encoded Extension or SEQUENCE OF Extensions to add to certificate * <li>http.param pathLenConstraint integer path length constraint to use in BasicConstraint extension if applicable * </ul> - * + * * @param cmsReq the object holding the request and response information */ public void process(CMSRequest cmsReq) throws EBaseException { @@ -364,21 +364,21 @@ public class ProcessCertReq extends CMSServlet { * Process X509 certificate enrollment request and send request information * to the caller. * <P> - * + * * (Certificate Request - an "agent" cert request for "cloning") * <P> - * + * * (Certificate Request Processed - either a manual "agent" non-profile based cert acceptance, a manual "agent" * non-profile based cert cancellation, or a manual "agent" non-profile based cert rejection) * <P> - * + * * <ul> * <li>signed.audit LOGGING_SIGNED_AUDIT_NON_PROFILE_CERT_REQUEST used when a non-profile cert request is made * (before approval process) * <li>signed.audit LOGGING_SIGNED_AUDIT_CERT_REQUEST_PROCESSED used when a certificate request has just been * through the approval process * </ul> - * + * * @param cmsReq a certificate enrollment request * @param argSet CMS template parameters * @param header argument block @@ -535,7 +535,7 @@ public class ProcessCertReq extends CMSServlet { if (!(algId.getName().equals(signatureAlgorithm))) { alterationCounter++; - AlgorithmId newAlgId = AlgorithmId.getAlgorithmId(signatureAlgorithm); + AlgorithmId newAlgId = AlgorithmId.get(signatureAlgorithm); certInfo[i].set(X509CertInfo.ALGORITHM_ID, new CertificateAlgorithmId(newAlgId)); @@ -590,7 +590,7 @@ public class ProcessCertReq extends CMSServlet { } } if (validityChanged) { - // this set() trigger this rebuild of internal + // this set() trigger this rebuild of internal // raw der encoding cache of X509CertInfo. // Otherwise, the above change wont have effect. certInfo[i].set(X509CertInfo.VALIDITY, certValidity); @@ -640,7 +640,7 @@ public class ProcessCertReq extends CMSServlet { certInfo[i].set(X509CertInfo.EXTENSIONS, extensions); } for (int j = 0; j < extsToBeAdded.size(); j++) { - Extension theExt = (Extension) extsToBeAdded.elementAt(j); + Extension theExt = extsToBeAdded.elementAt(j); extensions.set(theExt.getExtensionId().toString(), theExt); } @@ -683,8 +683,7 @@ public class ProcessCertReq extends CMSServlet { new BasicConstraintsExtension(isCA.booleanValue(), pathLen); extensions.delete(BasicConstraintsExtension.NAME); - extensions.set(BasicConstraintsExtension.NAME, - (Extension) bcExt0); + extensions.set(BasicConstraintsExtension.NAME, bcExt0); alterationCounter++; } } @@ -791,7 +790,7 @@ public class ProcessCertReq extends CMSServlet { } } - // this set() trigger this rebuild of internal + // this set() trigger this rebuild of internal // raw der encoding cache of X509CertInfo. // Otherwise, the above change wont have effect. certInfo[i].set(X509CertInfo.EXTENSIONS, extensions); @@ -913,12 +912,12 @@ public class ProcessCertReq extends CMSServlet { X509CertImpl issuedCerts[] = r.getExtDataInCertArray(IRequest.ISSUED_CERTS); - // return potentially more than one certificates. + // return potentially more than one certificates. if (issuedCerts != null) { long endTime = CMS.getCurrentDate().getTime(); StringBuffer sbuf = new StringBuffer(); - //header.addBigIntegerValue("serialNumber", + //header.addBigIntegerValue("serialNumber", //issuedCerts[0].getSerialNumber(),16); for (int i = 0; i < issuedCerts.length; i++) { if (i != 0) @@ -1000,7 +999,7 @@ public class ProcessCertReq extends CMSServlet { audit(auditMessage); } - // grant trusted manager or agent privileges + // grant trusted manager or agent privileges try { int res = grant_privileges( cmsReq, r, issuedCerts, header); @@ -1016,10 +1015,10 @@ public class ProcessCertReq extends CMSServlet { // since ther is no cert database. /* if (mAuthority instanceof RegistrationAuthority) { - Object[] results = + Object[] results = new Object[] { issuedCerts, grantError }; cmsReq.setResult(results); - renderTemplate(cmsReq, + renderTemplate(cmsReq, mReqCompletedTemplate, REQ_COMPLETED_FILLER); return; @@ -1039,7 +1038,7 @@ public class ProcessCertReq extends CMSServlet { "authorityid", mAuthority.getId()); header.addStringValue("serviceURL", scheme +"://"+ req.getServerName() + ":"+ - req.getServerPort() + + req.getServerPort() + req.getRequestURI()); */ @@ -1255,7 +1254,7 @@ public class ProcessCertReq extends CMSServlet { } } - // add authority names to know what privileges can be requested. + // add authority names to know what privileges can be requested. if (CMS.getSubsystem("kra") != null) header.addStringValue("localkra", "yes"); if (CMS.getSubsystem("ca") != null) @@ -1664,7 +1663,7 @@ public class ProcessCertReq extends CMSServlet { } } - String uid = (String) httpParams.getValueAsString(GRANT_UID, null); + String uid = httpParams.getValueAsString(GRANT_UID, null); if (uid == null || uid.length() == 0) { throw new ECMSGWException(CMS.getUserMessage("CMS_GW_MISSING_GRANT_UID")); @@ -1780,11 +1779,11 @@ public class ProcessCertReq extends CMSServlet { /** * Signed Audit Log Info Name - * + * * This method is called to obtain the "InfoName" for * a signed audit log message. * <P> - * + * * @param type signed audit log request processing type * @return id string containing the signed audit log message InfoName */ @@ -1815,11 +1814,11 @@ public class ProcessCertReq extends CMSServlet { /** * Signed Audit Log Info Certificate Value - * + * * This method is called to obtain the certificate from the passed in * "X509CertImpl" for a signed audit log message. * <P> - * + * * @param x509cert an X509CertImpl * @return cert string containing the certificate */ |