diff options
author | Oren Novotny <oren@novotny.org> | 2014-08-26 17:39:02 -0400 |
---|---|---|
committer | Oren Novotny <oren@novotny.org> | 2014-08-26 17:39:02 -0400 |
commit | 6dbc12162af086bbcfbd583dcaa8144d049c7fcc (patch) | |
tree | 3cf9443720ad508eb5ff615130d57fc118cb7145 /crypto/src/asn1/cms/TimeStampAndCRL.cs | |
parent | rename Crypto dir to crypto to match bc-git (diff) | |
parent | Rework the nonce-random initialisation and avoid GenerateSeed (diff) | |
download | BouncyCastle.NET-ed25519-6dbc12162af086bbcfbd583dcaa8144d049c7fcc.tar.xz |
Merge in bc-git to this repo
Diffstat (limited to 'crypto/src/asn1/cms/TimeStampAndCRL.cs')
-rw-r--r-- | crypto/src/asn1/cms/TimeStampAndCRL.cs | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/crypto/src/asn1/cms/TimeStampAndCRL.cs b/crypto/src/asn1/cms/TimeStampAndCRL.cs new file mode 100644 index 000000000..4cb5f2a52 --- /dev/null +++ b/crypto/src/asn1/cms/TimeStampAndCRL.cs @@ -0,0 +1,62 @@ +using System; + +namespace Org.BouncyCastle.Asn1.Cms +{ + public class TimeStampAndCrl + : Asn1Encodable + { + private ContentInfo timeStamp; + private X509.CertificateList crl; + + public TimeStampAndCrl(ContentInfo timeStamp) + { + this.timeStamp = timeStamp; + } + + private TimeStampAndCrl(Asn1Sequence seq) + { + this.timeStamp = ContentInfo.GetInstance(seq[0]); + if (seq.Count == 2) + { + this.crl = X509.CertificateList.GetInstance(seq[1]); + } + } + + public static TimeStampAndCrl GetInstance(object obj) + { + if (obj is TimeStampAndCrl) + return (TimeStampAndCrl)obj; + + if (obj != null) + return new TimeStampAndCrl(Asn1Sequence.GetInstance(obj)); + + return null; + } + + public virtual ContentInfo TimeStampToken + { + get { return this.timeStamp; } + } + + public virtual X509.CertificateList Crl + { + get { return this.crl; } + } + + /** + * <pre> + * TimeStampAndCRL ::= SEQUENCE { + * timeStamp TimeStampToken, -- according to RFC 3161 + * crl CertificateList OPTIONAL -- according to RFC 5280 + * } + * </pre> + * @return + */ + public override Asn1Object ToAsn1Object() + { + Asn1EncodableVector v = new Asn1EncodableVector(timeStamp); + v.AddOptional(crl); + return new DerSequence(v); + } + } +} |