summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-09-14 14:23:01 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-09-14 14:23:01 +0700
commit3124e402477d36636fad5ac3036ef56088cecf65 (patch)
treeae4c5b178e87d8fabd4feff0609448abb3d5dc3a
parentadded Dilithium ack (diff)
downloadBouncyCastle.NET-ed25519-3124e402477d36636fad5ac3036ef56088cecf65.tar.xz
DateTimeObject => nullable DateTime
-rw-r--r--crypto/src/ocsp/SingleResp.cs11
-rw-r--r--crypto/src/pkix/CertStatus.cs6
-rw-r--r--crypto/src/pkix/PkixCertPathValidatorUtilities.cs5
-rw-r--r--crypto/src/pkix/PkixCrlUtilities.cs3
-rw-r--r--crypto/src/pkix/PkixParameters.cs5
-rw-r--r--crypto/src/tsp/TimeStampResponseGenerator.cs23
-rw-r--r--crypto/src/util/date/DateTimeObject.cs25
-rw-r--r--crypto/src/x509/X509Crl.cs11
-rw-r--r--crypto/src/x509/store/X509AttrCertStoreSelector.cs5
-rw-r--r--crypto/src/x509/store/X509CertStoreSelector.cs9
-rw-r--r--crypto/src/x509/store/X509CrlStoreSelector.cs7
-rw-r--r--crypto/test/src/test/AttrCertSelectorTest.cs3
-rw-r--r--crypto/test/src/test/CertPathBuilderTest.cs5
-rw-r--r--crypto/test/src/test/CertPathValidatorTest.cs7
-rw-r--r--crypto/test/src/test/X509StoreTest.cs7
-rw-r--r--crypto/test/src/test/nist/NistCertPathTest.cs5
-rw-r--r--crypto/test/src/test/nist/NistCertPathTest2.cs5
-rw-r--r--crypto/test/src/tsp/test/NewTspTest.cs5
18 files changed, 36 insertions, 111 deletions
diff --git a/crypto/src/ocsp/SingleResp.cs b/crypto/src/ocsp/SingleResp.cs
index 66b2ce4b1..28e40e047 100644
--- a/crypto/src/ocsp/SingleResp.cs
+++ b/crypto/src/ocsp/SingleResp.cs
@@ -2,7 +2,6 @@ using System;
 
 using Org.BouncyCastle.Asn1.Ocsp;
 using Org.BouncyCastle.Asn1.X509;
-using Org.BouncyCastle.Utilities.Date;
 using Org.BouncyCastle.X509;
 
 namespace Org.BouncyCastle.Ocsp
@@ -56,15 +55,7 @@ namespace Org.BouncyCastle.Ocsp
 		*
 		* @return nextUpdate, or null if not present.
 		*/
-		public DateTimeObject NextUpdate
-		{
-			get
-			{
-				return resp.NextUpdate == null
-					?	null
-					:	new DateTimeObject(resp.NextUpdate.ToDateTime());
-			}
-		}
+		public DateTime? NextUpdate => resp.NextUpdate?.ToDateTime();
 
 		public X509Extensions SingleExtensions
 		{
diff --git a/crypto/src/pkix/CertStatus.cs b/crypto/src/pkix/CertStatus.cs
index 4f40b7bc6..aff1b1857 100644
--- a/crypto/src/pkix/CertStatus.cs
+++ b/crypto/src/pkix/CertStatus.cs
@@ -1,7 +1,5 @@
 using System;
 
-using Org.BouncyCastle.Utilities.Date;
-
 namespace Org.BouncyCastle.Pkix
 {
     public class CertStatus
@@ -12,12 +10,12 @@ namespace Org.BouncyCastle.Pkix
 
         private int status = Unrevoked;
 
-        DateTimeObject revocationDate = null;
+        DateTime? revocationDate = null;
 
         /// <summary>
         /// Returns the revocationDate.
         /// </summary>
-         public DateTimeObject RevocationDate
+         public DateTime? RevocationDate
         {
             get { return revocationDate; }
             set { this.revocationDate = value; }
diff --git a/crypto/src/pkix/PkixCertPathValidatorUtilities.cs b/crypto/src/pkix/PkixCertPathValidatorUtilities.cs
index 2514f1df2..a1c3ce734 100644
--- a/crypto/src/pkix/PkixCertPathValidatorUtilities.cs
+++ b/crypto/src/pkix/PkixCertPathValidatorUtilities.cs
@@ -11,7 +11,6 @@ using Org.BouncyCastle.Math;
 using Org.BouncyCastle.Security;
 using Org.BouncyCastle.Utilities;
 using Org.BouncyCastle.Utilities.Collections;
-using Org.BouncyCastle.Utilities.Date;
 using Org.BouncyCastle.X509;
 using Org.BouncyCastle.X509.Extension;
 using Org.BouncyCastle.X509.Store;
@@ -173,7 +172,7 @@ namespace Org.BouncyCastle.Pkix
 
 		internal static DateTime GetValidDate(PkixParameters paramsPKIX)
 		{
-			DateTimeObject validDate = paramsPKIX.Date;
+			DateTime? validDate = paramsPKIX.Date;
 
 			if (validDate == null)
 				return DateTime.UtcNow;
@@ -541,7 +540,7 @@ namespace Org.BouncyCastle.Pkix
 
             // (i) or (j)
             certStatus.Status = reasonCodeValue;
-            certStatus.RevocationDate = new DateTimeObject(revocationDate);
+            certStatus.RevocationDate = revocationDate;
         }
 
 		/**
diff --git a/crypto/src/pkix/PkixCrlUtilities.cs b/crypto/src/pkix/PkixCrlUtilities.cs
index 8740cc780..facbf56c2 100644
--- a/crypto/src/pkix/PkixCrlUtilities.cs
+++ b/crypto/src/pkix/PkixCrlUtilities.cs
@@ -2,7 +2,6 @@ using System;
 using System.Collections.Generic;
 
 using Org.BouncyCastle.Utilities.Collections;
-using Org.BouncyCastle.Utilities.Date;
 using Org.BouncyCastle.X509;
 using Org.BouncyCastle.X509.Store;
 
@@ -36,7 +35,7 @@ namespace Org.BouncyCastle.Pkix
 			// based on RFC 5280 6.3.3
 			foreach (X509Crl crl in initialSet)
 			{
-                DateTimeObject nextUpdate = crl.NextUpdate;
+                DateTime? nextUpdate = crl.NextUpdate;
 
                 if (null == nextUpdate || nextUpdate.Value.CompareTo(validityDate) > 0)
 				{
diff --git a/crypto/src/pkix/PkixParameters.cs b/crypto/src/pkix/PkixParameters.cs
index 8e4c609ed..89124f2e9 100644
--- a/crypto/src/pkix/PkixParameters.cs
+++ b/crypto/src/pkix/PkixParameters.cs
@@ -2,7 +2,6 @@ using System;
 using System.Collections.Generic;
 
 using Org.BouncyCastle.Utilities.Collections;
-using Org.BouncyCastle.Utilities.Date;
 using Org.BouncyCastle.X509;
 
 namespace Org.BouncyCastle.Pkix
@@ -38,7 +37,7 @@ namespace Org.BouncyCastle.Pkix
 		public const int ChainValidityModel = 1;
 
 		private HashSet<TrustAnchor> trustAnchors;
-		private DateTimeObject date;
+		private DateTime? date;
 		private List<PkixCertPathChecker> m_checkers;
 		private bool revocationEnabled = true;
 		private HashSet<string> initialPolicies;
@@ -174,7 +173,7 @@ namespace Org.BouncyCastle.Pkix
 		//	set { this.checkOnlyEECertificateCrl = value; }
 		//}
 
-		public virtual DateTimeObject Date
+		public virtual DateTime? Date
 		{
 			get { return this.date; }
 			set { this.date = value; }
diff --git a/crypto/src/tsp/TimeStampResponseGenerator.cs b/crypto/src/tsp/TimeStampResponseGenerator.cs
index 9a9c78678..76b400d6e 100644
--- a/crypto/src/tsp/TimeStampResponseGenerator.cs
+++ b/crypto/src/tsp/TimeStampResponseGenerator.cs
@@ -8,7 +8,6 @@ using Org.BouncyCastle.Asn1.Cms;
 using Org.BouncyCastle.Asn1.Tsp;
 using Org.BouncyCastle.Asn1.X509;
 using Org.BouncyCastle.Math;
-using Org.BouncyCastle.Utilities.Date;
 
 namespace Org.BouncyCastle.Tsp
 {
@@ -84,14 +83,6 @@ namespace Org.BouncyCastle.Tsp
             return new PkiStatusInfo(new DerSequence(v));
         }
 
-        public TimeStampResponse Generate(
-            TimeStampRequest request,
-            BigInteger serialNumber,
-            DateTime genTime)
-        {
-            return Generate(request, serialNumber, new DateTimeObject(genTime));
-        }
-
         /**
          * Return an appropriate TimeStampResponse.
          * <p>
@@ -107,10 +98,7 @@ namespace Org.BouncyCastle.Tsp
          * @throws TSPException
          * </p>
          */
-        public TimeStampResponse Generate(
-            TimeStampRequest request,
-            BigInteger serialNumber,
-            DateTimeObject genTime)
+        public TimeStampResponse Generate(TimeStampRequest request, BigInteger serialNumber, DateTime? genTime)
         {
             TimeStampResp resp;
 
@@ -164,13 +152,8 @@ namespace Org.BouncyCastle.Tsp
             }
         }
 
-
-        public TimeStampResponse GenerateGrantedResponse(
-            TimeStampRequest request,
-            BigInteger serialNumber,
-            DateTimeObject genTime, 
-            string statusString, 
-            X509Extensions additionalExtensions)
+        public TimeStampResponse GenerateGrantedResponse(TimeStampRequest request, BigInteger serialNumber,
+            DateTime? genTime, string statusString, X509Extensions additionalExtensions)
         {
             TimeStampResp resp;
 
diff --git a/crypto/src/util/date/DateTimeObject.cs b/crypto/src/util/date/DateTimeObject.cs
deleted file mode 100644
index 793376b6d..000000000
--- a/crypto/src/util/date/DateTimeObject.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-using System;
-
-namespace Org.BouncyCastle.Utilities.Date
-{
-	public sealed class DateTimeObject
-	{
-		private readonly DateTime dt;
-
-		public DateTimeObject(
-			DateTime dt)
-		{
-			this.dt = dt;
-		}
-
-		public DateTime Value
-		{
-			get { return dt; }
-		}
-
-		public override string ToString()
-		{
-			return dt.ToString();
-		}
-	}
-}
diff --git a/crypto/src/x509/X509Crl.cs b/crypto/src/x509/X509Crl.cs
index 8a7c51a1d..60660aab0 100644
--- a/crypto/src/x509/X509Crl.cs
+++ b/crypto/src/x509/X509Crl.cs
@@ -12,7 +12,6 @@ using Org.BouncyCastle.Math;
 using Org.BouncyCastle.Security;
 using Org.BouncyCastle.Security.Certificates;
 using Org.BouncyCastle.Utilities;
-using Org.BouncyCastle.Utilities.Date;
 using Org.BouncyCastle.Utilities.Encoders;
 using Org.BouncyCastle.X509.Extension;
 
@@ -163,15 +162,7 @@ namespace Org.BouncyCastle.X509
 			get { return c.ThisUpdate.ToDateTime(); }
 		}
 
-		public virtual DateTimeObject NextUpdate
-		{
-			get
-			{
-				return c.NextUpdate == null
-					?	null
-					:	new DateTimeObject(c.NextUpdate.ToDateTime());
-			}
-		}
+		public virtual DateTime? NextUpdate => c.NextUpdate?.ToDateTime();
 
 		private ISet<X509CrlEntry> LoadCrlEntries()
 		{
diff --git a/crypto/src/x509/store/X509AttrCertStoreSelector.cs b/crypto/src/x509/store/X509AttrCertStoreSelector.cs
index 5744289e9..e68208c74 100644
--- a/crypto/src/x509/store/X509AttrCertStoreSelector.cs
+++ b/crypto/src/x509/store/X509AttrCertStoreSelector.cs
@@ -5,7 +5,6 @@ using Org.BouncyCastle.Asn1;
 using Org.BouncyCastle.Asn1.X509;
 using Org.BouncyCastle.Math;
 using Org.BouncyCastle.Utilities.Collections;
-using Org.BouncyCastle.Utilities.Date;
 using Org.BouncyCastle.X509.Extension;
 
 namespace Org.BouncyCastle.X509.Store
@@ -23,7 +22,7 @@ namespace Org.BouncyCastle.X509.Store
 		// TODO: name constraints???
 
 		private X509V2AttributeCertificate attributeCert;
-		private DateTimeObject attributeCertificateValid;
+		private DateTime? attributeCertificateValid;
 		private AttributeCertificateHolder holder;
 		private AttributeCertificateIssuer issuer;
 		private BigInteger serialNumber;
@@ -162,7 +161,7 @@ namespace Org.BouncyCastle.X509.Store
 
 		/// <summary>The criteria for validity</summary>
 		/// <remarks>If <c>null</c> is given any will do.</remarks>
-		public DateTimeObject AttributeCertificateValid
+		public DateTime? AttributeCertificateValid
 		{
 			get { return attributeCertificateValid; }
 			set { this.attributeCertificateValid = value; }
diff --git a/crypto/src/x509/store/X509CertStoreSelector.cs b/crypto/src/x509/store/X509CertStoreSelector.cs
index 71b5419a7..357b5e76d 100644
--- a/crypto/src/x509/store/X509CertStoreSelector.cs
+++ b/crypto/src/x509/store/X509CertStoreSelector.cs
@@ -6,7 +6,6 @@ using Org.BouncyCastle.Asn1.X509;
 using Org.BouncyCastle.Math;
 using Org.BouncyCastle.Utilities;
 using Org.BouncyCastle.Utilities.Collections;
-using Org.BouncyCastle.Utilities.Date;
 using Org.BouncyCastle.X509.Extension;
 
 namespace Org.BouncyCastle.X509.Store
@@ -19,13 +18,13 @@ namespace Org.BouncyCastle.X509.Store
 		private byte[] authorityKeyIdentifier;
 		private int basicConstraints = -1;
 		private X509Certificate certificate;
-		private DateTimeObject certificateValid;
+		private DateTime? certificateValid;
 		private ISet<DerObjectIdentifier> extendedKeyUsage;
         private bool ignoreX509NameOrdering;
 		private X509Name issuer;
 		private bool[] keyUsage;
 		private ISet<DerObjectIdentifier> policy;
-		private DateTimeObject privateKeyValid;
+		private DateTime? privateKeyValid;
 		private BigInteger serialNumber;
 		private X509Name subject;
 		private byte[] subjectKeyIdentifier;
@@ -85,7 +84,7 @@ namespace Org.BouncyCastle.X509.Store
 			set { this.certificate = value; }
 		}
 
-		public DateTimeObject CertificateValid
+		public DateTime? CertificateValid
 		{
 			get { return certificateValid; }
 			set { certificateValid = value; }
@@ -124,7 +123,7 @@ namespace Org.BouncyCastle.X509.Store
 			set { policy = CopySet(value); }
 		}
 
-		public DateTimeObject PrivateKeyValid
+		public DateTime? PrivateKeyValid
 		{
 			get { return privateKeyValid; }
 			set { privateKeyValid = value; }
diff --git a/crypto/src/x509/store/X509CrlStoreSelector.cs b/crypto/src/x509/store/X509CrlStoreSelector.cs
index 365ec1d38..9e84b82ae 100644
--- a/crypto/src/x509/store/X509CrlStoreSelector.cs
+++ b/crypto/src/x509/store/X509CrlStoreSelector.cs
@@ -6,7 +6,6 @@ using Org.BouncyCastle.Asn1.X509;
 using Org.BouncyCastle.Math;
 using Org.BouncyCastle.Utilities;
 using Org.BouncyCastle.Utilities.Collections;
-using Org.BouncyCastle.Utilities.Date;
 using Org.BouncyCastle.X509.Extension;
 
 namespace Org.BouncyCastle.X509.Store
@@ -17,7 +16,7 @@ namespace Org.BouncyCastle.X509.Store
 		// TODO Missing criteria?
 
 		private X509Certificate certificateChecking;
-		private DateTimeObject dateAndTime;
+		private DateTime? dateAndTime;
 		private IList<X509Name> issuers;
 		private BigInteger maxCrlNumber;
 		private BigInteger minCrlNumber;
@@ -61,7 +60,7 @@ namespace Org.BouncyCastle.X509.Store
 			set { certificateChecking = value; }
 		}
 
-		public DateTimeObject DateAndTime
+		public DateTime? DateAndTime
 		{
 			get { return dateAndTime; }
 			set { dateAndTime = value; }
@@ -190,7 +189,7 @@ namespace Org.BouncyCastle.X509.Store
 			{
 				DateTime dt = dateAndTime.Value;
 				DateTime tu = c.ThisUpdate;
-				DateTimeObject nu = c.NextUpdate;
+				DateTime? nu = c.NextUpdate;
 
 				if (dt.CompareTo(tu) < 0 || nu == null || dt.CompareTo(nu.Value) >= 0)
 					return false;
diff --git a/crypto/test/src/test/AttrCertSelectorTest.cs b/crypto/test/src/test/AttrCertSelectorTest.cs
index cb5de3740..1e82f810c 100644
--- a/crypto/test/src/test/AttrCertSelectorTest.cs
+++ b/crypto/test/src/test/AttrCertSelectorTest.cs
@@ -8,7 +8,6 @@ using Org.BouncyCastle.Crypto;
 using Org.BouncyCastle.Crypto.Operators;
 using Org.BouncyCastle.Crypto.Parameters;
 using Org.BouncyCastle.Math;
-using Org.BouncyCastle.Utilities.Date;
 using Org.BouncyCastle.Utilities.Encoders;
 using Org.BouncyCastle.Utilities.Test;
 using Org.BouncyCastle.X509;
@@ -177,7 +176,7 @@ namespace Org.BouncyCastle.Tests
 				Fail("Selector does not match attribute certificate serial number.");
 			}
 
-			sel.AttributeCertificateValid = new DateTimeObject(DateTime.UtcNow);
+			sel.AttributeCertificateValid = DateTime.UtcNow;
 			match = sel.Match(aCert);
 			if (!match)
 			{
diff --git a/crypto/test/src/test/CertPathBuilderTest.cs b/crypto/test/src/test/CertPathBuilderTest.cs
index 305832ff3..35e73f9bb 100644
--- a/crypto/test/src/test/CertPathBuilderTest.cs
+++ b/crypto/test/src/test/CertPathBuilderTest.cs
@@ -7,7 +7,6 @@ using Org.BouncyCastle.Crypto;
 using Org.BouncyCastle.Math;
 using Org.BouncyCastle.Pkix;
 using Org.BouncyCastle.Utilities.Collections;
-using Org.BouncyCastle.Utilities.Date;
 using Org.BouncyCastle.Utilities.Test;
 using Org.BouncyCastle.X509;
 using Org.BouncyCastle.X509.Store;
@@ -57,7 +56,7 @@ namespace Org.BouncyCastle.Tests
             PkixBuilderParameters parameters = new PkixBuilderParameters(trust, targetConstraints);
             parameters.AddStoreCert(x509CertStore);
             parameters.AddStoreCrl(x509CrlStore);
-            parameters.Date = new DateTimeObject(validDate);
+            parameters.Date = validDate;
             PkixCertPathBuilderResult result = cpb.Build(parameters);
             PkixCertPath path = result.CertPath;
 
@@ -108,7 +107,7 @@ namespace Org.BouncyCastle.Tests
             buildParams.AddStoreCert(x509CertStore);
             buildParams.AddStoreCrl(x509CrlStore);
 
-            buildParams.Date = new DateTimeObject(DateTime.UtcNow);
+            buildParams.Date = DateTime.UtcNow;
 
             PkixCertPathBuilderResult result = builder.Build(buildParams);
             PkixCertPath path = result.CertPath;
diff --git a/crypto/test/src/test/CertPathValidatorTest.cs b/crypto/test/src/test/CertPathValidatorTest.cs
index 3c4577d59..d57d90acf 100644
--- a/crypto/test/src/test/CertPathValidatorTest.cs
+++ b/crypto/test/src/test/CertPathValidatorTest.cs
@@ -6,7 +6,6 @@ using NUnit.Framework;
 using Org.BouncyCastle.Crypto;
 using Org.BouncyCastle.Pkix;
 using Org.BouncyCastle.Utilities.Collections;
-using Org.BouncyCastle.Utilities.Date;
 using Org.BouncyCastle.Utilities.Encoders;
 using Org.BouncyCastle.Utilities.Test;
 using Org.BouncyCastle.X509;
@@ -165,7 +164,7 @@ namespace Org.BouncyCastle.Tests
             PkixParameters param = new PkixParameters(trust);
             param.AddStoreCert(x509CertStore);
             param.AddStoreCrl(x509CrlStore);
-            param.Date = new DateTimeObject(validDate);
+            param.Date = validDate;
             MyChecker checker = new MyChecker();
             param.AddCertPathChecker(checker);
 
@@ -197,7 +196,7 @@ namespace Org.BouncyCastle.Tests
             param = new PkixParameters(trust);
             param.AddStoreCert(x509CertStore);
             param.AddStoreCrl(x509CrlStore);
-            param.Date = new DateTimeObject(validDate);
+            param.Date = validDate;
             checker = new MyChecker();
             param.AddCertPathChecker(checker);
 
@@ -239,7 +238,7 @@ namespace Org.BouncyCastle.Tests
                 param = new PkixParameters(trust);
                 param.AddStoreCert(x509CertStore);
                 param.IsRevocationEnabled = false;
-                param.Date = new DateTimeObject(validDate);
+                param.Date = validDate;
 
                 result = cpv.Validate(cp, param);
                 policyTree = result.PolicyTree;
diff --git a/crypto/test/src/test/X509StoreTest.cs b/crypto/test/src/test/X509StoreTest.cs
index aada53e4e..2a8d44424 100644
--- a/crypto/test/src/test/X509StoreTest.cs
+++ b/crypto/test/src/test/X509StoreTest.cs
@@ -6,7 +6,6 @@ using NUnit.Framework;
 using Org.BouncyCastle.Asn1.X509;
 using Org.BouncyCastle.Math;
 using Org.BouncyCastle.Utilities.Collections;
-using Org.BouncyCastle.Utilities.Date;
 using Org.BouncyCastle.Utilities.Test;
 using Org.BouncyCastle.X509;
 using Org.BouncyCastle.X509.Store;
@@ -230,7 +229,7 @@ namespace Org.BouncyCastle.Tests
 			}
 
 			attrSelector = new X509AttrCertStoreSelector();
-			attrSelector.AttributeCertificateValid = new DateTimeObject(attrCert.NotBefore);
+			attrSelector.AttributeCertificateValid = attrCert.NotBefore;
 			if (attrSelector.AttributeCertificateValid.Value != attrCert.NotBefore)
 			{
 				Fail("valid get not correct");
@@ -241,13 +240,13 @@ namespace Org.BouncyCastle.Tests
 				Fail("attrCert not found on valid");
 			}
 			attrSelector = new X509AttrCertStoreSelector();
-			attrSelector.AttributeCertificateValid = new DateTimeObject(attrCert.NotBefore.AddMilliseconds(-100));
+			attrSelector.AttributeCertificateValid = attrCert.NotBefore.AddMilliseconds(-100);
 			attrs = new List<X509V2AttributeCertificate>(attrStore.EnumerateMatches(attrSelector));
 			if (attrs.Count != 0)
 			{
 				Fail("attrCert found on before");
 			}
-			attrSelector.AttributeCertificateValid = new DateTimeObject(attrCert.NotAfter.AddMilliseconds(100));
+			attrSelector.AttributeCertificateValid = attrCert.NotAfter.AddMilliseconds(100);
 			attrs = new List<X509V2AttributeCertificate>(attrStore.EnumerateMatches(attrSelector));
 			if (attrs.Count != 0)
 			{
diff --git a/crypto/test/src/test/nist/NistCertPathTest.cs b/crypto/test/src/test/nist/NistCertPathTest.cs
index 4a6391e8f..bdcd1b51f 100644
--- a/crypto/test/src/test/nist/NistCertPathTest.cs
+++ b/crypto/test/src/test/nist/NistCertPathTest.cs
@@ -8,7 +8,6 @@ using Org.BouncyCastle.Asn1;
 using Org.BouncyCastle.Asn1.X509;
 using Org.BouncyCastle.Pkix;
 using Org.BouncyCastle.Utilities.Collections;
-using Org.BouncyCastle.Utilities.Date;
 using Org.BouncyCastle.Utilities.Test;
 using Org.BouncyCastle.X509;
 using Org.BouncyCastle.X509.Extension;
@@ -682,7 +681,7 @@ namespace Org.BouncyCastle.Tests.Nist
 			}
 
 			// Perform validation as of this date since test certs expired
-			parameters.Date = new DateTimeObject(DateTime.Parse("1/1/2011"));
+			parameters.Date = DateTime.Parse("1/1/2011");
 
 			return validator.Validate(certPath, parameters);
 		}
@@ -743,7 +742,7 @@ namespace Org.BouncyCastle.Tests.Nist
 			builderParams.AddStoreCrl(x509CrlStore);
 
 			// Perform validation as of this date since test certs expired
-			builderParams.Date = new DateTimeObject(DateTime.Parse("1/1/2011"));
+			builderParams.Date = DateTime.Parse("1/1/2011");
 
 			try
 			{
diff --git a/crypto/test/src/test/nist/NistCertPathTest2.cs b/crypto/test/src/test/nist/NistCertPathTest2.cs
index 1bc40e805..e8b2e575c 100644
--- a/crypto/test/src/test/nist/NistCertPathTest2.cs
+++ b/crypto/test/src/test/nist/NistCertPathTest2.cs
@@ -7,7 +7,6 @@ using Org.BouncyCastle.Asn1;
 using Org.BouncyCastle.Asn1.X509;
 using Org.BouncyCastle.Pkix;
 using Org.BouncyCastle.Utilities.Collections;
-using Org.BouncyCastle.Utilities.Date;
 using Org.BouncyCastle.Utilities.Test;
 using Org.BouncyCastle.X509;
 using Org.BouncyCastle.X509.Extension;
@@ -349,7 +348,7 @@ namespace Org.BouncyCastle.Tests.Nist
 			}
 
 			// Perform validation as of this date since test certs expired
-			parameters.Date = new DateTimeObject(DateTime.Parse("1/1/2011"));
+			parameters.Date = DateTime.Parse("1/1/2011");
 
 			return validator.Validate(certPath, parameters);
         }
@@ -410,7 +409,7 @@ namespace Org.BouncyCastle.Tests.Nist
             builderParams.AddStoreCrl(x509CrlStore);
 
             // Perform validation as of this date since test certs expired
-            builderParams.Date = new DateTimeObject(DateTime.Parse("1/1/2011"));
+            builderParams.Date = DateTime.Parse("1/1/2011");
 
             try
             {
diff --git a/crypto/test/src/tsp/test/NewTspTest.cs b/crypto/test/src/tsp/test/NewTspTest.cs
index f6d45ef09..01dbc0e13 100644
--- a/crypto/test/src/tsp/test/NewTspTest.cs
+++ b/crypto/test/src/tsp/test/NewTspTest.cs
@@ -17,7 +17,6 @@ using Org.BouncyCastle.Crypto.Operators;
 using Org.BouncyCastle.Math;
 using Org.BouncyCastle.Utilities;
 using Org.BouncyCastle.Utilities.Collections;
-using Org.BouncyCastle.Utilities.Date;
 using Org.BouncyCastle.Utilities.Test;
 using Org.BouncyCastle.X509;
 
@@ -86,7 +85,7 @@ namespace Org.BouncyCastle.Tsp.Tests
 			extensionsGenerator.AddExtension(X509Extensions.AuditIdentity, false, new DerUtf8String("Test"));
 
 
-			TimeStampResponse tsResp = tsRespGen.GenerateGrantedResponse(request, new BigInteger("23"), new DateTimeObject( DateTime.UtcNow), "Okay", extensionsGenerator.Generate());
+			TimeStampResponse tsResp = tsRespGen.GenerateGrantedResponse(request, new BigInteger("23"), DateTime.UtcNow, "Okay", extensionsGenerator.Generate());
 
 			tsResp = new TimeStampResponse(tsResp.GetEncoded());
 
@@ -473,7 +472,7 @@ namespace Org.BouncyCastle.Tsp.Tests
 			//
 
 			tsResp = tsRespGen.Generate(request, new BigInteger("23"), null);
-					
+
 			tsResp = new TimeStampResponse(tsResp.GetEncoded());
 
 			TimeStampToken tsToken = tsResp.TimeStampToken;