コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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));
        }