private static List <EssCertId> ReadCertificates(DerSequenceReader reader) { var certificates = new List <EssCertId>(); while (reader.HasData) { var certificate = EssCertId.Read(reader); certificates.Add(certificate); } return(certificates); }
private static bool IsMatch(X509Certificate2 certificate, EssCertId essCertId) { if (essCertId.IssuerSerial != null) { if (!AreSerialNumbersEqual(essCertId.IssuerSerial, certificate)) { return(false); } if (!AreGeneralNamesEqual(essCertId.IssuerSerial, certificate)) { return(false); } } return(essCertId.CertificateHash.Length == SHA1HashLength); }
private static bool IsMatch(X509Certificate2 certificate, EssCertId essCertId) { if (essCertId.IssuerSerial != null) { if (!AreSerialNumbersEqual(essCertId.IssuerSerial, certificate)) { return(false); } if (!AreGeneralNamesEqual(essCertId.IssuerSerial, certificate)) { return(false); } } byte[] actualHash; using (var hashAlgorithm = CryptoHashUtility.GetSha1HashProvider()) { actualHash = hashAlgorithm.ComputeHash(certificate.RawData); } return(essCertId.CertificateHash.SequenceEqual(actualHash)); }