diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-09-13 16:52:12 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-09-13 16:52:12 +0700 |
commit | 828729a6c36faaa79e92d85f4789a28d54a5538f (patch) | |
tree | 04eb305accb8836ea6242bd530ca605bec2cb7db /crypto/src | |
parent | Rename file (diff) | |
download | BouncyCastle.NET-ed25519-828729a6c36faaa79e92d85f4789a28d54a5538f.tar.xz |
Use nullable DateTime instead of MinValue
Diffstat (limited to 'crypto/src')
-rw-r--r-- | crypto/src/crmf/CertificateRequestMessageBuilder.cs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/crypto/src/crmf/CertificateRequestMessageBuilder.cs b/crypto/src/crmf/CertificateRequestMessageBuilder.cs index 9a33fd964..38e95dfe7 100644 --- a/crypto/src/crmf/CertificateRequestMessageBuilder.cs +++ b/crypto/src/crmf/CertificateRequestMessageBuilder.cs @@ -71,9 +71,9 @@ namespace Org.BouncyCastle.Crmf return this; } - public CertificateRequestMessageBuilder SetValidity(Time notBefore, Time notAfter) + public CertificateRequestMessageBuilder SetValidity(DateTime? notBefore, DateTime? notAfter) { - _templateBuilder.SetValidity(new OptionalValidity(notBefore, notAfter)); + _templateBuilder.SetValidity(new OptionalValidity(CreateTime(notBefore), CreateTime(notAfter))); return this; } @@ -256,5 +256,10 @@ namespace Org.BouncyCastle.Crmf return new CertificateRequestMessage(CertReqMsg.GetInstance(new DerSequence(v))); } + + private static Time CreateTime(DateTime? dateTime) + { + return dateTime == null ? null : new Time(dateTime.Value); + } } } |