Use Find to look up hex serial 80 in sample.crl. The download’s certificate revocation list uses DER, a standard binary encoding.
dotnet add package RecursiveAI.OneCrypto --prereleaseRequires .NET 10 (net10.0); .NET 9 and earlier aren’t supported.
using RecursiveAI.OneCrypto; var der = File.ReadAllBytes("sample.crl"); var crl = CertificateRevocationList.Parse(der); var serial = Convert.FromHexString("80"); var entry = crl.Find(serial); Console.WriteLine(entry is not null);
Unzip the example, then dotnet run.
TrueThe full program
The binary sample.crl is a synthetic list signed with a throwaway key for this example. Its decoded issuer and only entry are:
Issuer: CN=Workshop Test CA Serial Number: 80 Revocation Date: Jan 1 00:00:00 2026 GMT
using RecursiveAI.OneCrypto; var der = File.ReadAllBytes("sample.crl"); var crl = CertificateRevocationList.Parse(der); foreach (string serial in new[] { "80", "0080", "81" }) { var entry = crl.Find(Convert.FromHexString(serial)); Console.WriteLine(entry is null ? $"{serial}: not listed" : $"{serial}: listed on {entry.RevocationDate:O}"); }
dotnet run prints:
80: listed on 2026-01-01T00:00:00.0000000+00:00 0080: listed on 2026-01-01T00:00:00.0000000+00:00 81: not listed
Parse throws X509ParseException for malformed CRL data; Find returns null when the serial number isn’t listed. Neither call verifies the CRL’s signature or whether it applies to a certificate.
Variations
Read a PEM list. Append this to the snippet at the top to try the PEM reader using the same list. For an existing PEM file, pass its text to FromPem instead of calling ToPem.
string pem = crl.ToPem(); var fromPem = CertificateRevocationList.FromPem(pem); Console.WriteLine(fromPem.Find(new byte[] { 0x80 }) is not null);
TrueRelated recipes
The short answer
Pass the bytes of the local DER CRL to CertificateRevocationList.Parse, then call Find with the serial number as bytes, most significant byte first. When you have hex text, turn it into bytes with Convert.FromHexString rather than passing the text’s UTF-8 bytes. A match gives you the recorded revocation date; null means only that the serial number wasn’t found in that file.
How do you check a certificate serial number against a CRL?
Use the serial number of the certificate you’re checking, not its thumbprint, the issuer’s serial number, or the CRL number. If you already have a parsed OneCrypto Certificate, its SerialNumber.Span is in the byte order Find expects. If you’re copying a displayed hex number, omit formatting such as 0x prefixes or separators before decoding it. Find takes the INTEGER’s content bytes, not the ASN.1 tag and length.
Find scans the entries and ignores leading zero bytes: DER can encode a positive value whose high bit is set with a leading 00. That’s why 80 and 0080 find the same entry, but 81 doesn’t. The property RevocationDate comes from the matched entry; it’s not the date the list was issued.
Does a missing CRL entry mean a certificate isn’t revoked?
Not by itself. A CRL covers a particular issuer and scope, and applies within a time window. Before relying on a CRL for a revocation decision, check that it’s applicable to the certificate, that it’s current for the time you’re checking, and that it was signed by an authorized issuer. A downloaded file can parse correctly without being a valid source of revocation information.
For a delta CRL, a missing entry doesn’t rule out a matching entry in the complete list it updates. For an indirect CRL, entries can cover certificates issued by more than one CA; a lookup by serial alone doesn’t resolve the certificate issuer. Both cases are handled as part of CRL validation in RFC 5280, not by searching one file. Use Find to inspect a list and a validator to decide whether a certificate can be trusted.