Exemplo n.º 1
0
        public RevokedInfo(
            DerGeneralizedTime  revocationTime,
            CrlReason           revocationReason)
        {
            if (revocationTime == null)
                throw new ArgumentNullException("revocationTime");

            this.revocationTime = revocationTime;
            this.revocationReason = revocationReason;
        }
Exemplo n.º 2
0
        private RevokedInfo(
            Asn1Sequence seq)
        {
            this.revocationTime = (DerGeneralizedTime) seq[0];

            if (seq.Count > 1)
            {
                this.revocationReason = new CrlReason(
                    DerEnumerated.GetInstance((Asn1TaggedObject) seq[1], true));
            }
        }
        public void AddCrlEntry(DerInteger userCertificate, Time revocationDate, int reason,
            DerGeneralizedTime invalidityDate)
        {
            IList extOids = Platform.CreateArrayList();
            IList extValues = Platform.CreateArrayList();

            if (reason != 0)
            {
                CrlReason crlReason = new CrlReason(reason);

                try
                {
                    extOids.Add(X509Extensions.ReasonCode);
                    extValues.Add(new X509Extension(false, new DerOctetString(crlReason.GetEncoded())));
                }
                catch (IOException e)
                {
                    throw new ArgumentException("error encoding reason: " + e);
                }
            }

            if (invalidityDate != null)
            {
                try
                {
                    extOids.Add(X509Extensions.InvalidityDate);
                    extValues.Add(new X509Extension(false, new DerOctetString(invalidityDate.GetEncoded())));
                }
                catch (IOException e)
                {
                    throw new ArgumentException("error encoding invalidityDate: " + e);
                }
            }

            if (extOids.Count != 0)
            {
                AddCrlEntry(userCertificate, revocationDate, new X509Extensions(extOids, extValues));
            }
            else
            {
                AddCrlEntry(userCertificate, revocationDate, null);
            }
        }