summary refs log tree commit diff
path: root/crypto/src/asn1/tsp/TSTInfo.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/asn1/tsp/TSTInfo.cs')
-rw-r--r--crypto/src/asn1/tsp/TSTInfo.cs47
1 files changed, 15 insertions, 32 deletions
diff --git a/crypto/src/asn1/tsp/TSTInfo.cs b/crypto/src/asn1/tsp/TSTInfo.cs
index 89f3e8b38..ee4dd67f1 100644
--- a/crypto/src/asn1/tsp/TSTInfo.cs
+++ b/crypto/src/asn1/tsp/TSTInfo.cs
@@ -214,37 +214,20 @@ namespace Org.BouncyCastle.Asn1.Tsp
 		 *
 		 * </pre>
 		 */
-		public override Asn1Object ToAsn1Object()
-		{
-			Asn1EncodableVector v = new Asn1EncodableVector(
-				version, tsaPolicyId, messageImprint, serialNumber, genTime);
-
-			if (accuracy != null)
-			{
-				v.Add(accuracy);
-			}
-
-			if (ordering != null && ordering.IsTrue)
-			{
-				v.Add(ordering);
-			}
-
-			if (nonce != null)
-			{
-				v.Add(nonce);
-			}
-
-			if (tsa != null)
-			{
-				v.Add(new DerTaggedObject(true, 0, tsa));
-			}
-
-			if (extensions != null)
-			{
-				v.Add(new DerTaggedObject(false, 1, extensions));
-			}
-
-			return new DerSequence(v);
-		}
+        public override Asn1Object ToAsn1Object()
+        {
+            Asn1EncodableVector v = new Asn1EncodableVector(version, tsaPolicyId, messageImprint, serialNumber, genTime);
+            v.AddOptional(accuracy);
+
+            if (ordering != null && ordering.IsTrue)
+            {
+                v.Add(ordering);
+            }
+
+            v.AddOptional(nonce);
+            v.AddOptionalTagged(true, 0, tsa);
+            v.AddOptionalTagged(false, 1, extensions);
+            return new DerSequence(v);
+        }
 	}
 }