private ResponseObject(
				CertificateID		certId,
				CertificateStatus	certStatus,
				DerGeneralizedTime	thisUpdate,
				DerGeneralizedTime	nextUpdate,
				X509Extensions		extensions)
			{
				this.certId = certId;

				if (certStatus == null)
				{
					this.certStatus = new CertStatus();
				}
				else if (certStatus is UnknownStatus)
				{
					this.certStatus = new CertStatus(2, DerNull.Instance);
				}
				else
				{
					RevokedStatus rs = (RevokedStatus) certStatus;
					CrlReason revocationReason = rs.HasRevocationReason
						?	new CrlReason(rs.RevocationReason)
						:	null;

					this.certStatus = new CertStatus(
						new RevokedInfo(new DerGeneralizedTime(rs.RevocationTime), revocationReason));
				}

				this.thisUpdate = thisUpdate;
				this.nextUpdate = nextUpdate;

				this.extensions = extensions;
			}
		public AttCertValidityPeriod(
            DerGeneralizedTime	notBeforeTime,
            DerGeneralizedTime	notAfterTime)
        {
            this.notBeforeTime = notBeforeTime;
            this.notAfterTime = notAfterTime;
        }
Esempio n. 3
0
		public SingleResponse(
            Asn1Sequence seq)
        {
            this.certID = CertID.GetInstance(seq[0]);
            this.certStatus = CertStatus.GetInstance(seq[1]);
            this.thisUpdate = (DerGeneralizedTime)seq[2];

			if (seq.Count > 4)
            {
                this.nextUpdate = DerGeneralizedTime.GetInstance(
					(Asn1TaggedObject) seq[3], true);
                this.singleExtensions = X509Extensions.GetInstance(
					(Asn1TaggedObject) seq[4], true);
            }
            else if (seq.Count > 3)
            {
                Asn1TaggedObject o = (Asn1TaggedObject) seq[3];

				if (o.TagNo == 0)
                {
                    this.nextUpdate = DerGeneralizedTime.GetInstance(o, true);
                }
                else
                {
                    this.singleExtensions = X509Extensions.GetInstance(o, true);
                }
            }
        }
        public RecipientKeyIdentifier(
            Asn1Sequence seq)
        {
            subjectKeyIdentifier = Asn1OctetString.GetInstance(
                seq[0]);

            switch(seq.Count)
            {
                case 1:
                    break;
                case 2:
                    if (seq[1] is DerGeneralizedTime)
                    {
                        date = (DerGeneralizedTime) seq[1];
                    }
                    else
                    {
                        other = OtherKeyAttribute.GetInstance(seq[2]);
                    }
                    break;
                case 3:
                    date  = (DerGeneralizedTime) seq[1];
                    other = OtherKeyAttribute.GetInstance(seq[2]);
                    break;
                default:
                    throw new ArgumentException("Invalid RecipientKeyIdentifier");
            }
        }
Esempio n. 5
0
		public ResponseData(
			ResponderID         responderID,
			DerGeneralizedTime  producedAt,
			Asn1Sequence        responses,
			X509Extensions      responseExtensions)
			: this(V1, responderID, producedAt, responses, responseExtensions)
		{
		}
Esempio n. 6
0
		public KekIdentifier(
            byte[]              keyIdentifier,
            DerGeneralizedTime  date,
            OtherKeyAttribute   other)
        {
            this.keyIdentifier = new DerOctetString(keyIdentifier);
            this.date = date;
            this.other = other;
        }
 public RecipientKeyIdentifier(
     Asn1OctetString         subjectKeyIdentifier,
     DerGeneralizedTime      date,
     OtherKeyAttribute       other)
 {
     this.subjectKeyIdentifier = subjectKeyIdentifier;
     this.date = date;
     this.other = other;
 }
		private AttCertValidityPeriod(
            Asn1Sequence seq)
        {
			if (seq.Count != 2)
				throw new ArgumentException("Bad sequence size: " + seq.Count);

			notBeforeTime = DerGeneralizedTime.GetInstance(seq[0]);
			notAfterTime = DerGeneralizedTime.GetInstance(seq[1]);
        }
Esempio n. 9
0
		public RecipientKeyIdentifier(
			byte[]				subjectKeyIdentifier,
			DerGeneralizedTime	date,
			OtherKeyAttribute	other)
		{
			this.subjectKeyIdentifier = new DerOctetString(subjectKeyIdentifier);
			this.date = date;
			this.other = other;
		}
Esempio n. 10
0
		public RevokedInfo(
            DerGeneralizedTime  revocationTime,
            CrlReason           revocationReason)
        {
			if (revocationTime == null)
				throw new ArgumentNullException("revocationTime");

			this.revocationTime = revocationTime;
            this.revocationReason = revocationReason;
        }
Esempio n. 11
0
		private RevokedInfo(
            Asn1Sequence seq)
        {
            this.revocationTime = (DerGeneralizedTime) seq[0];

			if (seq.Count > 1)
            {
                this.revocationReason = new CrlReason(
					DerEnumerated.GetInstance((Asn1TaggedObject) seq[1], true));
            }
        }
Esempio n. 12
0
		public ResponseData(
			DerInteger          version,
			ResponderID         responderID,
			DerGeneralizedTime  producedAt,
			Asn1Sequence        responses,
			X509Extensions      responseExtensions)
		{
			this.version = version;
			this.responderID = responderID;
			this.producedAt = producedAt;
			this.responses = responses;
			this.responseExtensions = responseExtensions;
		}
Esempio n. 13
0
		public SingleResponse(
            CertID              certID,
            CertStatus          certStatus,
            DerGeneralizedTime  thisUpdate,
            DerGeneralizedTime  nextUpdate,
            X509Extensions      singleExtensions)
        {
            this.certID = certID;
            this.certStatus = certStatus;
            this.thisUpdate = thisUpdate;
            this.nextUpdate = nextUpdate;
            this.singleExtensions = singleExtensions;
        }
        private string CalculateGmtOffset()
        {
            char     c        = '+';
            DateTime dateTime = this.ToDateTime();
            TimeSpan timeSpan = TimeZone.CurrentTimeZone.GetUtcOffset(dateTime);

            if (timeSpan.CompareTo(TimeSpan.Zero) < 0)
            {
                c        = '-';
                timeSpan = timeSpan.Duration();
            }
            int hours   = timeSpan.Hours;
            int minutes = timeSpan.Minutes;

            return(string.Concat(new object[]
            {
                "GMT",
                c,
                DerGeneralizedTime.Convert(hours),
                ":",
                DerGeneralizedTime.Convert(minutes)
            }));
        }
Esempio n. 15
0
		public RevokedInfo(
			DerGeneralizedTime revocationTime)
			: this(revocationTime, null)
		{
		}
Esempio n. 16
0
		private ResponseData(
			Asn1Sequence seq)
		{
			int index = 0;

			Asn1Encodable enc = seq[0];
			if (enc is Asn1TaggedObject)
			{
				Asn1TaggedObject o = (Asn1TaggedObject)enc;

				if (o.TagNo == 0)
				{
					this.versionPresent = true;
					this.version = DerInteger.GetInstance(o, true);
					index++;
				}
				else
				{
					this.version = V1;
				}
			}
			else
			{
				this.version = V1;
			}

			this.responderID = ResponderID.GetInstance(seq[index++]);
			this.producedAt = (DerGeneralizedTime)seq[index++];
			this.responses = (Asn1Sequence)seq[index++];

			if (seq.Count > index)
			{
				this.responseExtensions = X509Extensions.GetInstance(
					(Asn1TaggedObject)seq[index], true);
			}
		}
        protected override bool Asn1Equals(Asn1Object asn1Object)
        {
            DerGeneralizedTime derGeneralizedTime = asn1Object as DerGeneralizedTime;

            return(derGeneralizedTime != null && this.time.Equals(derGeneralizedTime.time));
        }