summaryrefslogtreecommitdiffstats
path: root/pki/base/common/src/com/netscape/cms/ocsp
diff options
context:
space:
mode:
Diffstat (limited to 'pki/base/common/src/com/netscape/cms/ocsp')
-rw-r--r--pki/base/common/src/com/netscape/cms/ocsp/DefStore.java57
-rw-r--r--pki/base/common/src/com/netscape/cms/ocsp/LDAPStore.java21
2 files changed, 41 insertions, 37 deletions
diff --git a/pki/base/common/src/com/netscape/cms/ocsp/DefStore.java b/pki/base/common/src/com/netscape/cms/ocsp/DefStore.java
index db61382c5..d3b5d545e 100644
--- a/pki/base/common/src/com/netscape/cms/ocsp/DefStore.java
+++ b/pki/base/common/src/com/netscape/cms/ocsp/DefStore.java
@@ -27,7 +27,6 @@ import java.util.Hashtable;
import java.util.Locale;
import java.util.Vector;
-import netscape.security.x509.CRLNumberExtension;
import netscape.security.x509.RevokedCertificate;
import netscape.security.x509.X509CRLImpl;
import netscape.security.x509.X509CertImpl;
@@ -48,6 +47,7 @@ import com.netscape.certsrv.common.Constants;
import com.netscape.certsrv.common.NameValuePairs;
import com.netscape.certsrv.dbs.IDBRegistry;
import com.netscape.certsrv.dbs.IDBSSession;
+import com.netscape.certsrv.dbs.IDBSearchResults;
import com.netscape.certsrv.dbs.IDBSubsystem;
import com.netscape.certsrv.dbs.Modification;
import com.netscape.certsrv.dbs.ModificationSet;
@@ -111,8 +111,6 @@ public class DefStore implements IDefStore, IExtendedPluginInfo {
private IConfigStore mConfig = null;
private String mId = null;
private IDBSubsystem mDBService = null;
- private X509CRLImpl mCRLImpl = null;
- private CRLNumberExtension mCRLNumberExt = null;
private int mStateCount = 0;
/**
@@ -226,15 +224,12 @@ public class DefStore implements IDefStore, IExtendedPluginInfo {
* new one is totally committed.
*/
public void deleteOldCRLs() throws EBaseException {
- Enumeration<Object> recs = searchCRLIssuingPointRecord(
+ Enumeration<ICRLIssuingPointRecord> recs = searchCRLIssuingPointRecord(
"objectclass=" +
CMS.getCRLIssuingPointRecordName(),
100);
- X509CertImpl theCert = null;
- ICRLIssuingPointRecord theRec = null;
-
while (recs.hasMoreElements()) {
- ICRLIssuingPointRecord rec = (ICRLIssuingPointRecord) recs.nextElement();
+ ICRLIssuingPointRecord rec = recs.nextElement();
deleteOldCRLsInCA(rec.getId());
}
}
@@ -252,14 +247,14 @@ public class DefStore implements IDefStore, IExtendedPluginInfo {
return; // nothing to do
String thisUpdate = Long.toString(
cp.getThisUpdate().getTime());
- Enumeration<Object> e = searchRepository(
+ Enumeration<IRepositoryRecord> e = searchRepository(
caName,
"(!" + IRepositoryRecord.ATTR_SERIALNO + "=" +
thisUpdate + ")");
while (e != null && e.hasMoreElements()) {
- IRepositoryRecord r = (IRepositoryRecord) e.nextElement();
- Enumeration<Object> recs =
+ IRepositoryRecord r = e.nextElement();
+ Enumeration<ICertRecord> recs =
searchCertRecord(caName,
r.getSerialNumber().toString(),
ICertRecord.ATTR_ID + "=*");
@@ -437,14 +432,13 @@ public class DefStore implements IDefStore, IExtendedPluginInfo {
mCacheCRLIssuingPoints.get(new String(keyhsh));
if (matched == null) {
- Enumeration<Object> recs = searchCRLIssuingPointRecord(
+ Enumeration<ICRLIssuingPointRecord> recs = searchCRLIssuingPointRecord(
"objectclass=" +
CMS.getCRLIssuingPointRecordName(),
100);
while (recs.hasMoreElements()) {
- ICRLIssuingPointRecord rec = (ICRLIssuingPointRecord)
- recs.nextElement();
+ ICRLIssuingPointRecord rec = recs.nextElement();
byte certdata[] = rec.getCACert();
X509CertImpl cert = null;
@@ -579,7 +573,7 @@ public class DefStore implements IDefStore, IExtendedPluginInfo {
return mDBService.getBaseDN();
}
- public Enumeration<Object> searchAllCRLIssuingPointRecord(int maxSize)
+ public Enumeration<ICRLIssuingPointRecord> searchAllCRLIssuingPointRecord(int maxSize)
throws EBaseException {
return searchCRLIssuingPointRecord(
"objectclass=" +
@@ -587,19 +581,22 @@ public class DefStore implements IDefStore, IExtendedPluginInfo {
maxSize);
}
- public Enumeration<Object> searchCRLIssuingPointRecord(String filter,
+ public Enumeration<ICRLIssuingPointRecord> searchCRLIssuingPointRecord(String filter,
int maxSize)
throws EBaseException {
IDBSSession s = mDBService.createSession();
- Enumeration<Object> e = null;
+ Vector<ICRLIssuingPointRecord> v = new Vector<ICRLIssuingPointRecord>();
try {
- e = s.search(getBaseDN(), filter, maxSize);
+ IDBSearchResults sr = s.search(getBaseDN(), filter, maxSize);
+ while (sr.hasMoreElements()) {
+ v.add((ICRLIssuingPointRecord) sr.nextElement());
+ }
} finally {
if (s != null)
s.close();
}
- return e;
+ return v.elements();
}
public synchronized void modifyCRLIssuingPointRecord(String name,
@@ -685,19 +682,22 @@ public class DefStore implements IDefStore, IExtendedPluginInfo {
}
}
- public Enumeration<Object> searchRepository(String name, String filter)
+ public Enumeration<IRepositoryRecord> searchRepository(String name, String filter)
throws EBaseException {
IDBSSession s = mDBService.createSession();
- Enumeration<Object> e = null;
+ Vector<IRepositoryRecord> v = new Vector<IRepositoryRecord>();
try {
- e = s.search("cn=" + transformDN(name) + "," + getBaseDN(),
+ IDBSearchResults sr = s.search("cn=" + transformDN(name) + "," + getBaseDN(),
filter);
+ while (sr.hasMoreElements()) {
+ v.add((IRepositoryRecord) sr.nextElement());
+ }
} finally {
if (s != null)
s.close();
}
- return e;
+ return v.elements();
}
/**
@@ -736,20 +736,23 @@ public class DefStore implements IDefStore, IExtendedPluginInfo {
}
}
- public Enumeration<Object> searchCertRecord(String name, String thisUpdate,
+ public Enumeration<ICertRecord> searchCertRecord(String name, String thisUpdate,
String filter) throws EBaseException {
IDBSSession s = mDBService.createSession();
- Enumeration<Object> e = null;
+ Vector<ICertRecord> v = new Vector<ICertRecord>();
try {
- e = s.search("ou=" + thisUpdate + ",cn=" +
+ IDBSearchResults sr = s.search("ou=" + thisUpdate + ",cn=" +
transformDN(name) + "," + getBaseDN(),
filter);
+ while (sr.hasMoreElements()) {
+ v.add((ICertRecord) sr.nextElement());
+ }
} finally {
if (s != null)
s.close();
}
- return e;
+ return v.elements();
}
public ICertRecord readCertRecord(String name, String thisUpdate,
diff --git a/pki/base/common/src/com/netscape/cms/ocsp/LDAPStore.java b/pki/base/common/src/com/netscape/cms/ocsp/LDAPStore.java
index 765a79504..697d1bb40 100644
--- a/pki/base/common/src/com/netscape/cms/ocsp/LDAPStore.java
+++ b/pki/base/common/src/com/netscape/cms/ocsp/LDAPStore.java
@@ -33,6 +33,7 @@ import netscape.ldap.LDAPEntry;
import netscape.ldap.LDAPException;
import netscape.ldap.LDAPSearchResults;
import netscape.ldap.LDAPv2;
+import netscape.security.x509.RevokedCertificate;
import netscape.security.x509.X509CRLImpl;
import netscape.security.x509.X509CertImpl;
import netscape.security.x509.X509Key;
@@ -395,9 +396,9 @@ public class LDAPStore implements IDefStore, IExtendedPluginInfo {
throw new EBaseException("NOT SUPPORTED");
}
- public Enumeration<Object> searchAllCRLIssuingPointRecord(int maxSize)
+ public Enumeration<ICRLIssuingPointRecord> searchAllCRLIssuingPointRecord(int maxSize)
throws EBaseException {
- Vector<Object> recs = new Vector<Object>();
+ Vector<ICRLIssuingPointRecord> recs = new Vector<ICRLIssuingPointRecord>();
Enumeration<X509CertImpl> keys = mCRLs.keys();
while (keys.hasMoreElements()) {
@@ -409,7 +410,7 @@ public class LDAPStore implements IDefStore, IExtendedPluginInfo {
return recs.elements();
}
- public Enumeration searchCRLIssuingPointRecord(String filter,
+ public Enumeration<ICRLIssuingPointRecord> searchCRLIssuingPointRecord(String filter,
int maxSize)
throws EBaseException {
return null;
@@ -672,11 +673,11 @@ class TempCRLIssuingPointRecord implements ICRLIssuingPointRecord {
return null;
}
- public Hashtable getCRLCacheNoClone() {
+ public Hashtable<BigInteger, RevokedCertificate> getCRLCacheNoClone() {
return null;
}
- public Hashtable getCRLCache() {
+ public Hashtable<BigInteger, RevokedCertificate> getCRLCache() {
return null;
}
@@ -717,25 +718,25 @@ class TempCRLIssuingPointRecord implements ICRLIssuingPointRecord {
/**
* Retrieves cache info of revoked certificates.
*/
- public Hashtable getRevokedCerts() {
+ public Hashtable<BigInteger, RevokedCertificate> getRevokedCerts() {
return mCRL.getListOfRevokedCertificates();
}
/**
* Retrieves cache info of unrevoked certificates.
*/
- public Hashtable getUnrevokedCerts() {
+ public Hashtable<BigInteger, RevokedCertificate> getUnrevokedCerts() {
return null;
}
/**
* Retrieves cache info of expired certificates.
*/
- public Hashtable getExpiredCerts() {
+ public Hashtable<BigInteger, RevokedCertificate> getExpiredCerts() {
return null;
}
- public Enumeration getSerializableAttrNames() {
+ public Enumeration<String> getSerializableAttrNames() {
return null;
}
@@ -750,7 +751,7 @@ class TempCRLIssuingPointRecord implements ICRLIssuingPointRecord {
}
- public Enumeration getElements() {
+ public Enumeration<Object> getElements() {
return null;
}
}