methodTstCustomKeyFilterCRL.LoadCRL
procedure LoadCRL(const aFileName: string; const aExpectedIssuer: iCertificate = nil);
Loads a single DER-encoded CRL file, verifies its signature against the issuing CA held in the KeyManager, enforces freshness per RevocationPolicy, indexes its revoked serials, and copies the file into Directory so it is re-loaded on the next PopulateKeyList. Use when an application obtains a CRL out-of-band (e.g. a manual download or a push) and wants it merged into the filter immediately rather than waiting for a directory scan. Raises if the signature is bad, the issuer is unknown, the certificate held for the issuer Name is not the CRL's alleged issuer (it lacks the cRLSign key usage, or the CRL's authorityKeyIdentifier gives no key identifier matching it), or (under rpHardFail) the CRL is stale. The cache file is Directory plus the file name of aFileName. Give each issuer and scope (issuer Name, issuingDistributionPoint, full or delta) a cache file name of its own, and pass aExpectedIssuer, the CA the list was requested from. A name with the extension .lock, or holding .tmp-{, in any letter case, is refused. A cache file that holds a list authenticated under a CA the KeyManager trusts, of another issuer or another scope than the list loaded, makes LoadCRL raise eDSIPkix naming the file, which stays as it was. A cache file that holds no list authenticated under a trusted CA is replaced. Without aExpectedIssuer a list of any CA the KeyManager trusts is accepted: another trusted CA's list, substituted on the way at a cache file name that has no file yet, is cached under that name, and the requested CA's lists are then refused there until that file is removed (the error names it; if a filter file lists it, RemoveCRL it and save the filter first). Passing aExpectedIssuer prevents that. The expected issuer binds the issuer, not the scope: the first list of an issuer a name holds sets the scope of that name, and a list of another scope substituted there is cleared the same way. Generation floors: the cache file, and every other file in Directory - whatever its name, FileFilter or not - that holds an authenticated list of the candidate's issuer and scope, expired or not, under any RevocationPolicy, besides the lists held in memory. Older numbers/times and conflicting equal-number bodies raise before cache mutation. Only regular files that start like a list are read further. A file FileFilter selects that cannot be read at that moment, the cache file being loaded under, selected or not, when it cannot be, or a Directory that cannot be listed, raises eDSIPkix and leaves the cache file as it was; retry. Any other file that cannot be read at that moment is no floor. Give the filter a Directory of its own: left blank it is the current directory, and a list kept outside FileFilter there is a floor only while it can be read. Stage downloads outside Directory: a file written there is a cache file. The revocations of the list are applied in memory before the last look at Directory: should that raise, because a callback or another program has changed a file meanwhile, they stay applied. A startup scan keeps the same order: of the lists of one issuer and scope that FileFilter selects, expired or not, it loads only one that no other of them outranks, under any RevocationPolicy (see Directory). Two loads of one issuer's lists under two names at the same time do not see each other's list. Signature, generation ordering and atomic cache replacement run under the filter write lock and an OS-backed cache-file transaction lease. Another manager/process writing that cache file fails immediately; retry after it has finished. On Windows a replacement can also fail while any other program has the file open, even one that shares deletion: another process's LoadCRL reading Directory, or its startup scan. LoadCRL then raises eDSIPkix with the file as it was; retry. Same-name refreshes need no RemoveCRL. With a FilterFileName, save the filter after each LoadCRL: the file is replaced at once and the CRLS section only at the save, and a thumbprint that no longer matches makes enabling the filter raise. A process that ends between the two, or another process's LoadCRL on a shared Directory, leaves that state.