summary refs log tree commit diff
path: root/crypto/src/tsp/TimeStampTokenInfo.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/tsp/TimeStampTokenInfo.cs')
-rw-r--r--crypto/src/tsp/TimeStampTokenInfo.cs21
1 files changed, 19 insertions, 2 deletions
diff --git a/crypto/src/tsp/TimeStampTokenInfo.cs b/crypto/src/tsp/TimeStampTokenInfo.cs
index cdef826bc..b9f0e3195 100644
--- a/crypto/src/tsp/TimeStampTokenInfo.cs
+++ b/crypto/src/tsp/TimeStampTokenInfo.cs
@@ -8,10 +8,27 @@ namespace Org.BouncyCastle.Tsp
 {
 	public class TimeStampTokenInfo
 	{
-		private TstInfo		tstInfo;
+		private static TstInfo ParseTstInfo(byte[] tstInfoEncoding)
+		{
+            try
+            {
+                return TstInfo.GetInstance(tstInfoEncoding);
+            }
+            catch (Exception e)
+            {
+                throw new TspException("unable to parse TstInfo encoding: " + e.Message);
+            }
+        }
+
+        private TstInfo		tstInfo;
 		private DateTime	genTime;
 
-		public TimeStampTokenInfo(
+        public TimeStampTokenInfo(byte[] tstInfoEncoding)
+			: this(ParseTstInfo(tstInfoEncoding))
+		{
+        }
+
+        public TimeStampTokenInfo(
 			TstInfo tstInfo)
 		{
 			this.tstInfo = tstInfo;