Skip to content

Commit 7e3c4c4

Browse files
committed
Kinda makes more sense to do the AKI check first
1 parent 670893f commit 7e3c4c4

1 file changed

Lines changed: 20 additions & 20 deletions

File tree

‎packages/server/src/helpers/isCertRevoked.ts‎

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -41,26 +41,6 @@ export async function isCertRevoked(
4141
return false;
4242
}
4343

44-
const extCRLDistributionPoints = extensions.find(
45-
(ext) => ext instanceof CRLDistributionPointsExtension,
46-
);
47-
48-
// Get all CRL URLs from within the certificate
49-
const crlURLs: string[] = [];
50-
51-
extCRLDistributionPoints?.distributionPoints?.forEach((dPoint) => {
52-
dPoint.distributionPoint?.fullName?.forEach((fullName) => {
53-
if (fullName.uniformResourceIdentifier) {
54-
crlURLs.push(fullName.uniformResourceIdentifier);
55-
}
56-
});
57-
});
58-
59-
// If no URL(s) is provided then we have nothing to check
60-
if (!(crlURLs.length > 0)) {
61-
return false;
62-
}
63-
6444
// Get the issuer's key identifier for part of the cache key and to check against the
6545
// certificate's and CRL's AuthorityKeyIdentifier extension
6646
const {
@@ -83,6 +63,26 @@ export async function isCertRevoked(
8363
);
8464
}
8565

66+
const extCRLDistributionPoints = extensions.find(
67+
(ext) => ext instanceof CRLDistributionPointsExtension,
68+
);
69+
70+
// Get all CRL URLs from within the certificate
71+
const crlURLs: string[] = [];
72+
73+
extCRLDistributionPoints?.distributionPoints?.forEach((dPoint) => {
74+
dPoint.distributionPoint?.fullName?.forEach((fullName) => {
75+
if (fullName.uniformResourceIdentifier) {
76+
crlURLs.push(fullName.uniformResourceIdentifier);
77+
}
78+
});
79+
});
80+
81+
// If no URL(s) is provided then we have nothing to check
82+
if (!(crlURLs.length > 0)) {
83+
return false;
84+
}
85+
8686
for (const crlURL of crlURLs) {
8787
// Key off of issuer public key and CRL URL in case multiple CRLs are specified
8888
const cacheKey = `${issuerKeyIdentifier}|${crlURL}`;

0 commit comments

Comments
 (0)