summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMatthew Miller <matthew@millerti.me>2020-06-12 23:49:54 -0700
committerMatthew Miller <matthew@millerti.me>2020-06-12 23:49:54 -0700
commita91a1f9e16c7aa09a79dd8de5916b9dd0b65cb5c (patch)
treefcf578beec1aa34a2f6052e968f99927e835c960
parenta4438ea6f1dca9f2537ae2b16fe6eba718752cd9 (diff)
Refresh “now” before checking notAfter
-rw-r--r--packages/server/src/attestation/verifications/verifyPacked.ts3
1 files changed, 2 insertions, 1 deletions
diff --git a/packages/server/src/attestation/verifications/verifyPacked.ts b/packages/server/src/attestation/verifications/verifyPacked.ts
index 3c32b16..d652d68 100644
--- a/packages/server/src/attestation/verifications/verifyPacked.ts
+++ b/packages/server/src/attestation/verifications/verifyPacked.ts
@@ -70,11 +70,12 @@ export default function verifyAttestationPacked(options: Options): boolean {
throw new Error('Certificate version was not `3` (ASN.1 value of 2) (Packed|Full)');
}
- const now = new Date();
+ let now = new Date();
if (notBefore > now) {
throw new Error(`Certificate not good before "${notBefore.toString()}"`);
}
+ now = new Date();
if (notAfter < now) {
throw new Error(`Certificate not good after "${notAfter.toString()}"`);
}