Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug2246422-(refinement of)ServerSideKeygen static SKID #4615

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions base/server/src/main/java/com/netscape/cmscore/cert/CertUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
import com.netscape.certsrv.logging.AuditEvent;
import com.netscape.certsrv.logging.ILogger;
import com.netscape.certsrv.logging.LogEvent;
import com.netscape.certsrv.profile.EProfileException;
import com.netscape.certsrv.request.IRequest;
import com.netscape.cms.logging.Logger;
import com.netscape.cms.logging.SignedAuditLogger;
Expand Down Expand Up @@ -194,7 +193,7 @@ public static PKCS10 parsePKCS10(Locale locale, String certreq) throws Exception

if (certreq == null) {
logger.error("CertUtils: Missing PKCS #10 request");
throw new EProfileException(CMS.getUserMessage(locale, "CMS_PROFILE_INVALID_REQUEST"));
throw new EBaseException(CMS.getUserMessage(locale, "CMS_PROFILE_INVALID_REQUEST"));
}

logger.debug(certreq);
Expand Down Expand Up @@ -228,7 +227,7 @@ public static PKCS10 parsePKCS10(Locale locale, String certreq) throws Exception

} catch (Exception e) {
logger.error("Unable to parse PKCS #10 request: " + e.getMessage(), e);
throw new EProfileException(CMS.getUserMessage(locale, "CMS_PROFILE_INVALID_REQUEST"), e);
throw new EBaseException(CMS.getUserMessage(locale, "CMS_PROFILE_INVALID_REQUEST"), e);

} finally {
if (sigver) {
Expand All @@ -244,7 +243,7 @@ public static CertReqMsg[] parseCRMF(Locale locale, String certreq) throws Excep

if (certreq == null) {
logger.error("CertUtils: Missing CRMF request");
throw new EProfileException(CMS.getUserMessage(locale, "CMS_PROFILE_INVALID_REQUEST"));
throw new EBaseException(CMS.getUserMessage(locale, "CMS_PROFILE_INVALID_REQUEST"));
}

byte[] data = CertUtil.parseCSR(certreq);
Expand All @@ -268,7 +267,7 @@ public static CertReqMsg[] parseCRMF(Locale locale, String certreq) throws Excep

} catch (Exception e) {
logger.error("Unable to parse CRMF request: " + e.getMessage(), e);
throw new EProfileException(CMS.getUserMessage(locale, "CMS_PROFILE_INVALID_REQUEST"), e);
throw new EBaseException(CMS.getUserMessage(locale, "CMS_PROFILE_INVALID_REQUEST"), e);
}
}

Expand Down Expand Up @@ -572,9 +571,9 @@ public static String getCertType(X509CertImpl cert) throws CertificateParsingExc
}

public static void addExtension(String name, Extension ext, X509CertInfo info)
throws EProfileException {
throws EBaseException {
if (ext == null) {
throw new EProfileException("addExtension: extension '" + name + "' is null");
throw new EBaseException("addExtension: extension '" + name + "' is null");
}
CertificateExtensions exts = null;

Expand All @@ -583,7 +582,7 @@ public static void addExtension(String name, Extension ext, X509CertInfo info)
if (alreadyPresentExtension != null) {
String eName = ext.toString();
logger.error("Duplicate extension: " + eName);
throw new EProfileException(CMS.getUserMessage("CMS_PROFILE_DUPLICATE_EXTENSION", eName));
throw new EBaseException(CMS.getUserMessage("CMS_PROFILE_DUPLICATE_EXTENSION", eName));
}

try {
Expand All @@ -593,7 +592,7 @@ public static void addExtension(String name, Extension ext, X509CertInfo info)
logger.warn("EnrollDefault: " + e.getMessage(), e);
}
if (exts == null) {
throw new EProfileException("extensions not found");
throw new EBaseException("extensions not found");
}
try {
exts.set(name, ext);
Expand Down Expand Up @@ -630,11 +629,11 @@ public static void deleteExtension(String extID, X509CertInfo info) throws Excep
}

public static void replaceExtension(String name, Extension ext, X509CertInfo info)
throws EProfileException {
throws EBaseException {
try {
deleteExtension(name, info);
} catch (Exception e) {
throw new EProfileException(e);
throw new EBaseException(e);
}

addExtension(name, ext, info);
Expand Down
Loading