Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,10 @@
public class CRLDownloadWorker extends BaseWorker {
private static final Logger log = Logger.getLogger(CRLDownloadWorker.class);

public static final String PROP_IGNORE_NEXT_UPDATE = "ignoreNextUpdate";
public static final String PROP_MAX_DOWNLOAD_SIZE = "maxDownloadSize";
public static final String PROP_IGNORE_NEXT_UPDATE_LEGACY = "ignoreNextUpdate";
public static final String PROP_MAX_DOWNLOAD_SIZE_LEGACY = "maxDownloadSize";
public static final String PROP_IGNORE_NEXT_UPDATE = "worker.ignoreNextUpdate";
public static final String PROP_MAX_DOWNLOAD_SIZE = "worker.maxDownloadSize";
public static final int DEFAULT_MAX_DOWNLOAD_SIZE = 1 * 1024 * 1024;

@Override
Expand Down Expand Up @@ -152,7 +154,12 @@ private void getCrlAndUpdateIfNeeded(final CAInfo caInfo, final X509Certificate
final CrlStoreSessionLocal crlStoreSession, final ImportCrlSessionLocal importCrlSession) throws ServiceExecutionFailedException {
try {
final String issuerDn = CertTools.getSubjectDN(caCertificate);
final boolean ignoreNextUpdate = PropertyTools.get(properties, PROP_IGNORE_NEXT_UPDATE, false);
final boolean ignoreNextUpdate;
if (properties.getProperty(PROP_IGNORE_NEXT_UPDATE) != null) {
ignoreNextUpdate = PropertyTools.get(properties, PROP_IGNORE_NEXT_UPDATE, false);
} else {
ignoreNextUpdate = PropertyTools.get(properties, PROP_IGNORE_NEXT_UPDATE_LEGACY, false);
}
// Get last known CRL (if any) and check when the next update will be
final X509CRL lastFullCrl = getCRLFromBytes(crlStoreSession.getLastCRL(issuerDn, crlPartitionIndex, false));
final X509CRL newestFullCrl;
Expand Down Expand Up @@ -212,7 +219,12 @@ private X509CRL getCRLFromBytes(final byte[] crlBytes) throws CRLException {

private X509CRL getAndProcessCrl(final URL cdpUrl, final X509Certificate caCertificate, final CAInfo caInfo,
final ImportCrlSessionLocal importCrlSession, final int crlPartitionIndex) throws CrlStoreException, CrlImportException, ServiceExecutionFailedException {
final int maxSize = PropertyTools.get(properties, PROP_MAX_DOWNLOAD_SIZE, DEFAULT_MAX_DOWNLOAD_SIZE);
final int maxSize;
if (properties.getProperty(PROP_MAX_DOWNLOAD_SIZE) != null) {
maxSize = PropertyTools.get(properties, PROP_MAX_DOWNLOAD_SIZE, DEFAULT_MAX_DOWNLOAD_SIZE);
} else {
maxSize = PropertyTools.get(properties, PROP_MAX_DOWNLOAD_SIZE_LEGACY, DEFAULT_MAX_DOWNLOAD_SIZE);
}
X509CRL newCrl = null;
final byte[] crlBytesNew = NetworkTools.downloadDataFromUrl(cdpUrl, maxSize);
if (crlBytesNew == null) {
Expand Down