Skip to content

Commit 33ca48a

Browse files
committed
doc: use reviewer wording for X509Certificate dates
Apply the review suggestions for validFromDate and validToDate. Signed-off-by: Sarthak Ahuja <39986642+SarthakAhuja@users.noreply.github.com>
1 parent 02ed95d commit 33ca48a

1 file changed

Lines changed: 18 additions & 16 deletions

File tree

‎doc/api/crypto.md‎

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3532,14 +3532,15 @@ added:
35323532

35333533
The date/time from which this certificate is valid, encapsulated in a `Date` object.
35343534

3535-
If the certificate's `notBefore` time cannot be parsed, this is an invalid
3536-
`Date` (its `getTime()` method returns `NaN`). Every relational comparison
3537-
with an invalid `Date` evaluates to `false`. To check whether a certificate
3538-
is currently valid, test that the current time is inside the validity window
3539-
(`now >= x509.validFromDate && now <= x509.validToDate`), which rejects an
3540-
invalid bound. Do not test whether it is outside the window
3541-
(`now < x509.validFromDate || now > x509.validToDate`): with an invalid
3542-
bound, that test is `false` and the certificate appears valid.
3535+
If the certificate's `notBefore` time cannot be parsed, this property is an
3536+
invalid `Date` whose `getTime()` method returns `NaN`.
3537+
3538+
Relational comparisons with an invalid `Date` evaluate to `false`. To check
3539+
whether the current time is within the certificate's validity period, use
3540+
`now >= x509.validFromDate && now <= x509.validToDate`. This expression
3541+
evaluates to `false` if either date is invalid. Checking
3542+
`now < x509.validFromDate || now > x509.validToDate` instead can fail to
3543+
reject certificates with invalid dates.
35433544

35443545
### `x509.validTo`
35453546

@@ -3566,14 +3567,15 @@ added:
35663567

35673568
The date/time until which this certificate is valid, encapsulated in a `Date` object.
35683569

3569-
If the certificate's `notAfter` time cannot be parsed, this is an invalid
3570-
`Date` (its `getTime()` method returns `NaN`). Every relational comparison
3571-
with an invalid `Date` evaluates to `false`. To check whether a certificate
3572-
is currently valid, test that the current time is inside the validity window
3573-
(`now >= x509.validFromDate && now <= x509.validToDate`), which rejects an
3574-
invalid bound. Do not test whether it is outside the window
3575-
(`now < x509.validFromDate || now > x509.validToDate`): with an invalid
3576-
bound, that test is `false` and the certificate appears valid.
3570+
If the certificate's `notAfter` time cannot be parsed, this property is an
3571+
invalid `Date` whose `getTime()` method returns `NaN`.
3572+
3573+
Relational comparisons with an invalid `Date` evaluate to `false`. To check
3574+
whether the current time is within the certificate's validity period, use
3575+
`now >= x509.validFromDate && now <= x509.validToDate`. This expression
3576+
evaluates to `false` if either date is invalid. Checking
3577+
`now < x509.validFromDate || now > x509.validToDate` instead can fail to
3578+
reject certificates with invalid dates.
35773579

35783580
### `x509.signature`
35793581

0 commit comments

Comments
 (0)