diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2019-08-01 15:20:29 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2019-08-01 15:20:29 +0700 |
commit | abe0572ea59671d9444b61bf3ad4458518c2805d (patch) | |
tree | ec5fcb0c70214b941c036589be9656ca79d24a3b /crypto/src/asn1/cms | |
parent | Rework some of the ImplSquare methods in custom binary curves (diff) | |
download | BouncyCastle.NET-ed25519-abe0572ea59671d9444b61bf3ad4458518c2805d.tar.xz |
Misc. ASN.1 updates from bc-java
Diffstat (limited to 'crypto/src/asn1/cms')
-rw-r--r-- | crypto/src/asn1/cms/Evidence.cs | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/crypto/src/asn1/cms/Evidence.cs b/crypto/src/asn1/cms/Evidence.cs index 8374aed55..b12f090a9 100644 --- a/crypto/src/asn1/cms/Evidence.cs +++ b/crypto/src/asn1/cms/Evidence.cs @@ -8,6 +8,7 @@ namespace Org.BouncyCastle.Asn1.Cms : Asn1Encodable, IAsn1Choice { private TimeStampTokenEvidence tstEvidence; + private Asn1Sequence otherEvidence; public Evidence(TimeStampTokenEvidence tstEvidence) { @@ -16,11 +17,23 @@ namespace Org.BouncyCastle.Asn1.Cms private Evidence(Asn1TaggedObject tagged) { - if (tagged.TagNo == 0) - { - this.tstEvidence = TimeStampTokenEvidence.GetInstance(tagged, false); - } - } + if (tagged.TagNo == 0) + { + this.tstEvidence = TimeStampTokenEvidence.GetInstance(tagged, false); + } + //else if (tagged.TagNo == 1) + //{ + // this.ersEvidence = EvidenceRecord.GetInstance(tagged, false); + //} + else if (tagged.TagNo == 2) + { + this.otherEvidence = Asn1Sequence.GetInstance(tagged, false); + } + else + { + throw new ArgumentException("unknown tag in Evidence", "tagged"); + } + } public static Evidence GetInstance(object obj) { @@ -33,17 +46,28 @@ namespace Org.BouncyCastle.Asn1.Cms throw new ArgumentException("Unknown object in GetInstance: " + Platform.GetTypeName(obj), "obj"); } + public static Evidence GetInstance(Asn1TaggedObject obj, bool isExplicit) + { + return GetInstance(obj.GetObject()); // must be explicitly tagged + } + public virtual TimeStampTokenEvidence TstEvidence { get { return tstEvidence; } } + //public EvidenceRecord ErsEvidence + //{ + // get { return ersEvidence; } + //} + public override Asn1Object ToAsn1Object() { if (tstEvidence != null) return new DerTaggedObject(false, 0, tstEvidence); - - return null; + //if (ersEvidence != null) + // return new DerTaggedObject(false, 1, ersEvidence); + return new DerTaggedObject(false, 2, otherEvidence); } } } |