From 81718ad166d0dd458ed070e753d1f4bfcc40593d Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Sun, 26 May 2024 17:22:18 +0700 Subject: Auto-adjust DateTime precision for GeneralizedTime in X.509 (and OCSP) - see https://github.com/bcgit/bc-csharp/issues/474 --- crypto/src/asn1/esf/OcspIdentifier.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'crypto/src/asn1/esf/OcspIdentifier.cs') diff --git a/crypto/src/asn1/esf/OcspIdentifier.cs b/crypto/src/asn1/esf/OcspIdentifier.cs index fa7069aed..fa3d60291 100644 --- a/crypto/src/asn1/esf/OcspIdentifier.cs +++ b/crypto/src/asn1/esf/OcspIdentifier.cs @@ -1,6 +1,7 @@ using System; using Org.BouncyCastle.Asn1.Ocsp; +using Org.BouncyCastle.Asn1.X509; using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Esf @@ -50,12 +51,8 @@ namespace Org.BouncyCastle.Asn1.Esf } public OcspIdentifier(ResponderID ocspResponderID, DateTime producedAt) + : this(ocspResponderID, Rfc5280Asn1Utilities.CreateGeneralizedTime(producedAt)) { - if (ocspResponderID == null) - throw new ArgumentNullException(nameof(ocspResponderID)); - - this.ocspResponderID = ocspResponderID; - this.producedAt = new Asn1GeneralizedTime(producedAt); } public OcspIdentifier(ResponderID ocspResponderID, Asn1GeneralizedTime producedAt) -- cgit 1.4.1