summary refs log tree commit diff
path: root/crypto/src/asn1/cms
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/asn1/cms')
-rw-r--r--crypto/src/asn1/cms/Evidence.cs38
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);
 		}
 	}
 }