// crlRawData could a type of System.String and pass the path to a CRL file there. public static DateTime?GetrevocationDate(X509Certificate2 cert, Byte[] crlRawData) { X509CRL2 crl = new X509CRL2(crlRawData); X509CRLEntry entry = crl.RevokedCertificates[cert.SerialNumber]; if (entry != null) { return(entry.RevocationDate); } return(null); }
void m_initialize(Asn1Reader response) { response.MoveNext(); CertId = new CertID(Asn1Utils.Encode(response.GetPayload(), 48)); response.MoveNextCurrentLevel(); switch (response.Tag) { case 128: CertStatus = CertificateStatus.Good; response.MoveNextCurrentLevel(); break; case 161: CertStatus = CertificateStatus.Revoked; response.MoveNext(); DateTime revokedWhen = Asn1Utils.DecodeGeneralizedTime(response.GetTagRawData()); response.MoveNext(); Int16 reason = 0; if (response.Tag == 160) { response.MoveNext(); reason = response.GetPayload()[0]; response.MoveNext(); } RevocationInfo = new X509CRLEntry(CertId.SerialNumber, revokedWhen, reason); break; case 130: CertStatus = CertificateStatus.Unknown; response.MoveNextCurrentLevel(); break; } //response.MoveNextCurrentLevel(); ThisUpdate = Asn1Utils.DecodeGeneralizedTime(response.GetTagRawData()); while (response.MoveNextCurrentLevel()) { switch (response.Tag) { case 160: Asn1Reader asn = new Asn1Reader(response.GetPayload()); NextUpdate = Asn1Utils.DecodeGeneralizedTime(asn.GetTagRawData()); break; case 161: Extensions.Decode(response.GetPayload()); break; } } }