Esempio n. 1
0
 /// <summary>
 ///  Compares two CertID objects for equality.
 /// </summary>
 /// <param name="obj">An CertID object to compare to the current object. </param>
 /// <remarks>Two objects are considered equal if they are CertID objects and they have the same fields:
 /// HashAlgorithm, IssuerNameId, IssuerKeyId and SerialNumber.</remarks>
 /// <returns>true if the current CertID object is equal to the object specified by the other parameter; otherwise, false.</returns>
 public Boolean Equals(CertID obj)
 {
     return(HashingAlgorithm.Value == obj.HashingAlgorithm.Value &&
            IssuerNameId == obj.IssuerNameId &&
            IssuerKeyId == obj.IssuerKeyId &&
            SerialNumber == obj.SerialNumber);
 }
Esempio n. 2
0
        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;
                }
            }
        }