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

Adding useful OCSP debug messages #4506

Merged
merged 1 commit into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
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
15 changes: 11 additions & 4 deletions base/ocsp/src/main/java/com/netscape/cms/ocsp/LDAPStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cms.ocsp;

import java.lang.Integer;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.cert.X509CRL;
Expand Down Expand Up @@ -246,12 +247,13 @@ public void updateCRLHash(X509CertImpl caCert, X509CRLImpl crl)

if (oldCRL != null) {
if (oldCRL.getThisUpdate().getTime() >= crl.getThisUpdate().getTime()) {
logger.info("LDAPStore: no update, received CRL is older than current CRL");
logger.info("LDAPStore: no update, received CRL is not newer than current CRL");
return; // no update
}
}
logger.debug("Added '" + caCert.getSubjectName() + "' into CRL hash");
logger.debug("LDAPStore: updateCRLHash: Added '" + caCert.getSubjectName() + "' into CRL hash");
mCRLs.put(caCert, crl);
logger.debug("LDAPStore: updateCRLHash: mCRLs size= "+ mCRLs.size());
}

@Override
Expand Down Expand Up @@ -418,16 +420,20 @@ public SingleResponse processRequest(Request req) throws Exception {
logger.info("LDAPStore: Checking against " + caCert.getSubjectName());

MessageDigest md = MessageDigest.getInstance(cid.getDigestName());
logger.debug("LDAPStore: processRequest: cert digest name=" +
cid.getDigestName());
X509Key key = (X509Key) caCert.getPublicKey();

if (key == null) {
logger.debug("LDAPStore: processRequest: mCRLs caCert.getPublicKey() returns null");
throw new Exception("Missing issuer key");
}

byte digest[] = md.digest(key.getKey());
byte keyhsh[] = cid.getIssuerKeyHash().toByteArray();

if (!Arrays.equals(digest, keyhsh)) {
logger.debug("LDAPStore: processRequest: CA key digest and cert issuer key hash do not match; continue to look at next CA in mCRLs...");
continue;
}

Expand All @@ -438,11 +444,12 @@ public SingleResponse processRequest(Request req) throws Exception {
}

if (theCert == null) {
throw new Exception("Missing issuer certificate");
throw new Exception("Issuer certificate not found/served");
}

if (theCRL == null) {
throw new Exception("Missing CRL data");
throw new Exception("Missing CRL data for issuing CA:" +
theCert.getSubjectDN());
}

GeneralizedTime thisUpdate = new GeneralizedTime(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -415,14 +415,14 @@ protected synchronized void process(CMSRequest cmsReq)
(pt.getThisUpdate().getTime() >=
crl.getThisUpdate().getTime())) {

logger.warn("AddCRLServlet: no update, received CRL is older than current CRL");
logger.warn("AddCRLServlet: no update, received CRL is not newer than current CRL");

if (noUI) {
try {
resp.setContentType("application/text");
resp.getOutputStream().write("status=1\n".getBytes());
resp.getOutputStream().write(
"error=Sent CRL is older than the current CRL\n".getBytes());
"error=Sent CRL is not newer than the current CRL\n".getBytes());
resp.getOutputStream().flush();
cmsReq.setStatus(CMSRequest.SUCCESS);

Expand All @@ -435,7 +435,7 @@ protected synchronized void process(CMSRequest cmsReq)
} catch (Exception e) {
}
} else {
logger.error("AddCRLServlet: CRL is older");
logger.error("AddCRLServlet: CRL is not newer");

// NOTE: The signed audit events
// LOGGING_SIGNED_AUDIT_CRL_RETRIEVAL and
Expand Down
Loading