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;
|