micro509 0.18.0 → 0.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +109 -1
- package/dist/crypto/crypto.d.ts +11 -2
- package/dist/crypto/crypto.js +30 -17
- package/dist/crypto/crypto.js.map +1 -1
- package/dist/crypto.d.ts +2 -2
- package/dist/der/der.js.map +1 -1
- package/dist/index.d.ts +7 -6
- package/dist/internal/asn1/asn1.js +10 -2
- package/dist/internal/asn1/asn1.js.map +1 -1
- package/dist/internal/asn1/ber.js.map +1 -1
- package/dist/internal/asn1/decode-refusal.js.map +1 -1
- package/dist/internal/asn1/der.js.map +1 -1
- package/dist/internal/asn1/oids.js.map +1 -1
- package/dist/internal/crypto/algorithm-names.js.map +1 -1
- package/dist/internal/crypto/ecdsa.js.map +1 -1
- package/dist/internal/crypto/hash.js +64 -64
- package/dist/internal/crypto/hash.js.map +1 -1
- package/dist/internal/crypto/pbes2.js +3 -3
- package/dist/internal/crypto/pbes2.js.map +1 -1
- package/dist/internal/crypto/prime-ec.js.map +1 -1
- package/dist/internal/crypto/rsa-pss.js.map +1 -1
- package/dist/internal/crypto/sig-verify.d.ts +40 -0
- package/dist/internal/crypto/sig-verify.js +152 -65
- package/dist/internal/crypto/sig-verify.js.map +1 -1
- package/dist/internal/crypto/signing.js.map +1 -1
- package/dist/internal/jose/base64url.js.map +1 -1
- package/dist/internal/jose/json-data.js.map +1 -1
- package/dist/internal/jose/strict-json.js.map +1 -1
- package/dist/internal/shared/base64.js.map +1 -1
- package/dist/internal/shared/dn.js +1 -1
- package/dist/internal/shared/dn.js.map +1 -1
- package/dist/internal/shared/idna-tables.js +3 -3
- package/dist/internal/shared/idna.js.map +1 -1
- package/dist/internal/shared/ip.js.map +1 -1
- package/dist/internal/shared/mailbox.js.map +1 -1
- package/dist/internal/shared/punycode.js +1 -1
- package/dist/internal/shared/punycode.js.map +1 -1
- package/dist/internal/shared/uri-host.js.map +1 -1
- package/dist/internal/verify/name-constraints-engine.js.map +1 -1
- package/dist/internal/verify/policy-engine.js.map +1 -1
- package/dist/internal/verify/spki-distrust.js.map +1 -1
- package/dist/internal/verify/verify-path.js +222 -116
- package/dist/internal/verify/verify-path.js.map +1 -1
- package/dist/internal/x509/directory-name.js.map +1 -1
- package/dist/internal/x509/extension-bits.js.map +1 -1
- package/dist/internal/x509/extension-errors.js.map +1 -1
- package/dist/internal/x509/extension-registry.js.map +1 -1
- package/dist/internal/x509/general-name-profile.js.map +1 -1
- package/dist/internal/x509/general-name.js.map +1 -1
- package/dist/internal/x509/name-fields.js.map +1 -1
- package/dist/internal/x509/or-address.js.map +1 -1
- package/dist/jose/base64url.js.map +1 -1
- package/dist/jose/errors.js.map +1 -1
- package/dist/jose/jwe.js.map +1 -1
- package/dist/jose/jwks.js.map +1 -1
- package/dist/jose/jws.js.map +1 -1
- package/dist/jose/jwt.js.map +1 -1
- package/dist/jose/remote-jwks.js.map +1 -1
- package/dist/kdf/argon2-arithmetic.js.map +1 -1
- package/dist/kdf/argon2-core.js.map +1 -1
- package/dist/kdf/argon2-memory.js.map +1 -1
- package/dist/kdf/argon2-portable.js +1 -1
- package/dist/kdf/argon2-portable.js.map +1 -1
- package/dist/kdf/argon2.js +2 -2
- package/dist/kdf/argon2.js.map +1 -1
- package/dist/keys/keys.d.ts +7 -2
- package/dist/keys/keys.js +10 -6
- package/dist/keys/keys.js.map +1 -1
- package/dist/pem/pem.d.ts +20 -7
- package/dist/pem/pem.js +24 -20
- package/dist/pem/pem.js.map +1 -1
- package/dist/pem.d.ts +2 -2
- package/dist/pkcs/pfx.js.map +1 -1
- package/dist/pkcs/pkcs12-mac.js +3 -3
- package/dist/pkcs/pkcs12-mac.js.map +1 -1
- package/dist/pkcs/pkcs7.d.ts +10 -0
- package/dist/pkcs/pkcs7.js +106 -88
- package/dist/pkcs/pkcs7.js.map +1 -1
- package/dist/result/result.js.map +1 -1
- package/dist/revocation/chain.d.ts +67 -13
- package/dist/revocation/chain.js +429 -301
- package/dist/revocation/chain.js.map +1 -1
- package/dist/revocation/crl.d.ts +65 -11
- package/dist/revocation/crl.js +472 -182
- package/dist/revocation/crl.js.map +1 -1
- package/dist/revocation/ocsp.d.ts +79 -24
- package/dist/revocation/ocsp.js +417 -231
- package/dist/revocation/ocsp.js.map +1 -1
- package/dist/revocation/revocation.d.ts +68 -13
- package/dist/revocation/revocation.js +194 -73
- package/dist/revocation/revocation.js.map +1 -1
- package/dist/revocation.d.ts +4 -4
- package/dist/ssh/ssh.js.map +1 -1
- package/dist/ssh/wire.js.map +1 -1
- package/dist/verify/identity.d.ts +2 -2
- package/dist/verify/identity.js +2 -2
- package/dist/verify/identity.js.map +1 -1
- package/dist/verify/verify.d.ts +84 -32
- package/dist/verify/verify.js +221 -175
- package/dist/verify/verify.js.map +1 -1
- package/dist/verify.d.ts +3 -2
- package/dist/x509/certificate.js.map +1 -1
- package/dist/x509/csr.js.map +1 -1
- package/dist/x509/extensions.js +1 -1
- package/dist/x509/extensions.js.map +1 -1
- package/dist/x509/fingerprint.js.map +1 -1
- package/dist/x509/name-text.js +1 -1
- package/dist/x509/name-text.js.map +1 -1
- package/dist/x509/name.js.map +1 -1
- package/dist/x509/parse.d.ts +6 -2
- package/dist/x509/parse.js +121 -121
- package/dist/x509/parse.js.map +1 -1
- package/package.json +16 -16
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { SignatureVerifiers } from "../internal/crypto/sig-verify.js";
|
|
2
|
+
import { DecodeFailureCode, Result } from "../result/result.js";
|
|
3
|
+
import { CertificateRevocationListMaterial, CheckCertificateRevocationAgainstCrlErrorCode, CheckCertificateRevocationAgainstCrlFailure, CheckCertificateRevocationAgainstCrlFailureDetails, CheckCertificateRevocationAgainstCrlGoodValue, CheckCertificateRevocationAgainstCrlInput, CheckCertificateRevocationAgainstCrlResult, CheckCertificateRevocationAgainstCrlRevokedValue, CheckCertificateRevocationAgainstCrlValue, CreateCertificateRevocationListInput, CrlApplicabilityFailureReason, CrlCertificateSource, CrlEncoderErrorCode, CrlSource, ParseCertificateRevocationListErrorCode, ParseCertificateRevocationListFailure, ParseCertificateRevocationListResult, ParsedCertificateRevocationList, ParsedRevocationReason, ParsedRevokedCertificate, RevocationReason, RevokedCertificateInput, SupersededDeltaCrlPolicy, UnrecognizedReasonCodePolicy, UnrecognizedRevocationReason, ValidateCertificateRevocationListFailure, ValidateCertificateRevocationListInput, ValidateCertificateRevocationListResult, VerifyCertificateRevocationListSignatureFailure, VerifyCertificateRevocationListSignatureOptions, VerifyCertificateRevocationListSignatureResult, checkCertificateRevocationAgainstCrl, createCertificateRevocationList, isCertificateRevoked, parseCertificateRevocationListDer, parseCertificateRevocationListDerOrThrow, parseCertificateRevocationListPem, parseCertificateRevocationListPemOrThrow, revocationReasonFromCode, validateCertificateRevocationList, verifyCertificateRevocationListSignature } from "./crl.js";
|
|
4
|
+
import { CreateOcspCertStatusInput, CreateOcspRequestInput, CreateOcspRequestItemInput, CreateOcspResponseInput, CreateOcspSingleResponseInput, OcspCertStatus, OcspCertificateSource, OcspEncoderErrorCode, OcspHashAlgorithm, OcspRequestMaterial, OcspRequestSource, OcspResponderRevocationPolicy, OcspResponseMaterial, OcspResponseStatus, ParseOcspRequestErrorCode, ParseOcspRequestFailure, ParseOcspRequestResult, ParseOcspResponseErrorCode, ParseOcspResponseFailure, ParseOcspResponseResult, ParsedOcspCertId, ParsedOcspCertStatus, ParsedOcspRequest, ParsedOcspResponderId, ParsedOcspResponse, ParsedOcspSingleResponse, RevocationSkipReason, ValidateOcspResponseErrorCode, ValidateOcspResponseFailure, ValidateOcspResponseInput, ValidateOcspResponseResult, VerifyOcspResponseSignatureFailure, VerifyOcspResponseSignatureOptions, VerifyOcspResponseSignatureResult, createOcspRequest, createOcspResponse, hasOcspNoCheckExtension, parseOcspRequestDer, parseOcspRequestDerOrThrow, parseOcspRequestPem, parseOcspRequestPemOrThrow, parseOcspResponseDer, parseOcspResponseDerOrThrow, parseOcspResponsePem, parseOcspResponsePemOrThrow, validateOcspResponse, verifyOcspResponseSignature } from "./ocsp.js";
|
|
4
5
|
import { ParsedCertificate } from "../x509/parse.js";
|
|
5
6
|
/** Unified revocation outcome across CRL and OCSP evidence. */
|
|
6
|
-
export type RevocationStatus = "good" | "revoked" | "indeterminate";
|
|
7
|
+
export type RevocationStatus = "good" | "revoked" | "indeterminate" | "skipped";
|
|
7
8
|
/** Which revocation mechanism produced the evidence. */
|
|
8
9
|
export type RevocationEvidenceKind = "crl" | "ocsp";
|
|
9
10
|
/** PEM string, DER bytes, or already-parsed certificate. */
|
|
@@ -67,7 +68,10 @@ export interface CheckCertificateRevocationInput {
|
|
|
67
68
|
readonly evidence?: readonly RevocationEvidenceInput[];
|
|
68
69
|
/** Evaluation time. Defaults to `new Date()`. */
|
|
69
70
|
readonly at?: Date;
|
|
70
|
-
/**
|
|
71
|
+
/**
|
|
72
|
+
* Clock-skew tolerance in milliseconds. It also widens `crlMaxAgeMs`.
|
|
73
|
+
* Throws `RangeError` when negative or not finite.
|
|
74
|
+
*/
|
|
71
75
|
readonly clockSkewMs?: number;
|
|
72
76
|
/** Maximum age of each CRL's `thisUpdate` in milliseconds. Unbounded by default. See {@linkcode ValidateCertificateRevocationListInput.maxAgeMs}. */
|
|
73
77
|
readonly crlMaxAgeMs?: number;
|
|
@@ -76,6 +80,13 @@ export interface CheckCertificateRevocationInput {
|
|
|
76
80
|
* {@linkcode ValidateOcspResponseInput.profile}. Defaults to `'rfc6960'`.
|
|
77
81
|
*/
|
|
78
82
|
readonly ocspProfile?: ValidateOcspResponseInput["profile"];
|
|
83
|
+
/**
|
|
84
|
+
* Revocation policy for delegated OCSP responders. The CRLs in `evidence`,
|
|
85
|
+
* delta CRLs included, serve as their revocation evidence. See
|
|
86
|
+
* {@linkcode OcspResponderRevocationPolicy}. Defaults to
|
|
87
|
+
* `'nocheck-or-evidence'`.
|
|
88
|
+
*/
|
|
89
|
+
readonly ocspResponderRevocation?: OcspResponderRevocationPolicy;
|
|
79
90
|
/**
|
|
80
91
|
* Treatment of CRL or OCSP evidence whose CRLReason is unrecognized. See
|
|
81
92
|
* {@linkcode UnrecognizedReasonCodePolicy}. `'reject'` turns that evidence
|
|
@@ -83,11 +94,25 @@ export interface CheckCertificateRevocationInput {
|
|
|
83
94
|
* settling the status as `good`. Defaults to `'revoked'`.
|
|
84
95
|
*/
|
|
85
96
|
readonly unrecognizedReasonCode?: UnrecognizedReasonCodePolicy;
|
|
97
|
+
/**
|
|
98
|
+
* Treatment of delta CRLs in `evidence` that the attempt limits leave unread
|
|
99
|
+
* although one already read supersedes them, for the certificate and its
|
|
100
|
+
* delegated OCSP responders. See {@linkcode SupersededDeltaCrlPolicy}.
|
|
101
|
+
* Defaults to `'indeterminate'`.
|
|
102
|
+
*/
|
|
103
|
+
readonly unreadSupersededDeltaCrls?: SupersededDeltaCrlPolicy;
|
|
104
|
+
/**
|
|
105
|
+
* Caller verifiers for signature algorithms micro509 does not verify through
|
|
106
|
+
* WebCrypto, keyed by dotted-decimal signature algorithm OID, for the CRL and
|
|
107
|
+
* OCSP evidence. A key that micro509 verifies natively, a key that is no OID,
|
|
108
|
+
* or a value that is no function throws `RangeError`.
|
|
109
|
+
*/
|
|
110
|
+
readonly signatureVerifiers?: SignatureVerifiers;
|
|
86
111
|
}
|
|
87
112
|
/** Error codes that {@linkcode checkCertificateRevocation} may surface inside an `indeterminate` result. */
|
|
88
|
-
export type CheckCertificateRevocationErrorCode = "revocation_evidence_missing" | "revocation_status_indeterminate" |
|
|
113
|
+
export type CheckCertificateRevocationErrorCode = "revocation_evidence_missing" | "revocation_status_indeterminate" | DecodeFailureCode;
|
|
89
114
|
/** Every {@linkcode RevocationIndeterminateReasonCode}, as a runtime array. */
|
|
90
|
-
export declare const REVOCATION_INDETERMINATE_REASON_CODES: readonly ["certificate_status_missing", "certificate_status_unknown", "crl_sign_not_permitted", "issuer_mismatch", "next_update_missing", "non_applicable", "nonce_mismatch", "ocsp_signing_missing", "reason_code_unrecognized", "reason_coverage_incomplete", "request_mismatch", "responder_id_mismatch", "responder_chain_invalid", "responder_revoked", "responder_revocation_unknown", "response_status_invalid", "signature_invalid", "stale_crl", "stale_response", "unsupported", "limit_exceeded"];
|
|
115
|
+
export declare const REVOCATION_INDETERMINATE_REASON_CODES: readonly ["certificate_status_missing", "certificate_status_unknown", "crl_sign_not_permitted", "delta_crl_retry_limit_exceeded", "delta_crl_unusable", "issuer_mismatch", "malformed", "next_update_missing", "non_applicable", "nonce_mismatch", "ocsp_signing_missing", "reason_code_unrecognized", "reason_coverage_incomplete", "request_mismatch", "responder_id_mismatch", "responder_chain_invalid", "responder_revoked", "responder_revocation_unknown", "response_status_invalid", "signature_invalid", "stale_crl", "stale_response", "unsupported", "limit_exceeded"];
|
|
91
116
|
/** Why a particular piece of evidence could not produce a definitive `good`/`revoked` answer. */
|
|
92
117
|
export type RevocationIndeterminateReasonCode = (typeof REVOCATION_INDETERMINATE_REASON_CODES)[number];
|
|
93
118
|
/** One piece of evidence that failed to produce a definitive revocation answer. */
|
|
@@ -143,8 +168,21 @@ export interface RevocationCheckRevokedValue {
|
|
|
143
168
|
/** CRL reason code (from OCSP evidence). */
|
|
144
169
|
readonly revocationReasonCode?: bigint;
|
|
145
170
|
}
|
|
146
|
-
/**
|
|
147
|
-
|
|
171
|
+
/**
|
|
172
|
+
* The certificate carries noRevAvail, so no evidence was consulted (RFC 9608
|
|
173
|
+
* §4). A CRL never lists such a certificate (RFC 9608 §2), so its absence from
|
|
174
|
+
* one shows nothing.
|
|
175
|
+
*/
|
|
176
|
+
export interface RevocationCheckSkippedValue {
|
|
177
|
+
/** Status is skipped. */
|
|
178
|
+
readonly status: Extract<RevocationStatus, "skipped">;
|
|
179
|
+
/** The extension that exempts the certificate. */
|
|
180
|
+
readonly skipReason: Extract<RevocationSkipReason, "no_rev_avail">;
|
|
181
|
+
/** Human-readable diagnostic message. */
|
|
182
|
+
readonly message: string;
|
|
183
|
+
}
|
|
184
|
+
/** Discriminated union of `good`, `revoked`, `indeterminate`, and `skipped` revocation outcomes. */
|
|
185
|
+
export type CheckCertificateRevocationValue = RevocationCheckGoodValue | RevocationCheckRevokedValue | RevocationCheckIndeterminateValue | RevocationCheckSkippedValue;
|
|
148
186
|
/**
|
|
149
187
|
* Result of {@linkcode checkCertificateRevocation}. Always succeeds (`ok: true`) —
|
|
150
188
|
* the `value.status` discriminator carries the actual outcome.
|
|
@@ -159,8 +197,25 @@ export declare function getCertificateOcspResponderUris(certificate: RevocationC
|
|
|
159
197
|
export declare function resolveOcspResponderCandidates(input: ResolveOcspResponderCandidatesInput): readonly OcspResponderCandidate[];
|
|
160
198
|
/**
|
|
161
199
|
* Evaluates all provided CRL and OCSP evidence to determine the certificate's
|
|
162
|
-
* revocation status. Returns the first `revoked` if any
|
|
163
|
-
*
|
|
200
|
+
* revocation status. Returns the first `revoked` if any. Otherwise an OCSP
|
|
201
|
+
* `good` settles the status, then a CRL `good` once the CRLs together cover
|
|
202
|
+
* every revocation reason, else `indeterminate` with diagnostic details about
|
|
203
|
+
* each indeterminate evidence.
|
|
204
|
+
* Each CRL in `evidence` counts as a delta CRL when it carries the delta CRL
|
|
205
|
+
* indicator and as a complete CRL otherwise, whichever field holds it. Each
|
|
206
|
+
* distinct complete CRL is checked once, updated by the newest delta CRL
|
|
207
|
+
* among them that applies to it, as `checkChainRevocation` does, within the
|
|
208
|
+
* same attempt limits, which the CRL checks of delegated OCSP responders
|
|
209
|
+
* share. A delta CRL that cannot settle the status records
|
|
210
|
+
* `delta_crl_unusable` in `details.indeterminateEvidence`, and a candidate
|
|
211
|
+
* the limits leave unread that counts under `unreadSupersededDeltaCrls`
|
|
212
|
+
* records `delta_crl_retry_limit_exceeded` there; either keeps other evidence
|
|
213
|
+
* from settling the status as `good`. Unless other evidence revokes the
|
|
214
|
+
* certificate, the result is then `indeterminate` with the top-level code
|
|
215
|
+
* `revocation_status_indeterminate`.
|
|
216
|
+
* A certificate carrying noRevAvail is `skipped` without consulting evidence
|
|
217
|
+
* (RFC 9608 §4). One carrying id-pkix-ocsp-nocheck is still checked against
|
|
218
|
+
* the evidence, which may list it as revoked.
|
|
164
219
|
*
|
|
165
220
|
* @example
|
|
166
221
|
* ```ts
|
|
@@ -176,5 +231,5 @@ export declare function resolveOcspResponderCandidates(input: ResolveOcspRespond
|
|
|
176
231
|
* }
|
|
177
232
|
* ```
|
|
178
233
|
*/
|
|
179
|
-
export declare function checkCertificateRevocation(
|
|
180
|
-
export type { CertificateRevocationListMaterial, CheckCertificateRevocationAgainstCrlErrorCode, CheckCertificateRevocationAgainstCrlFailure, CheckCertificateRevocationAgainstCrlFailureDetails, CheckCertificateRevocationAgainstCrlGoodValue, CheckCertificateRevocationAgainstCrlInput, CheckCertificateRevocationAgainstCrlResult, CheckCertificateRevocationAgainstCrlRevokedValue, CheckCertificateRevocationAgainstCrlValue, CreateCertificateRevocationListInput, CreateOcspCertStatusInput, CreateOcspRequestInput, CreateOcspRequestItemInput, CreateOcspResponseInput, CreateOcspSingleResponseInput, CrlApplicabilityFailureReason, CrlCertificateSource, CrlEncoderErrorCode, CrlSource, OcspCertStatus, OcspCertificateSource, OcspEncoderErrorCode, OcspHashAlgorithm, OcspRequestMaterial, OcspRequestSource, OcspResponderRevocationPolicy, OcspResponseMaterial, OcspResponseStatus, ParseCertificateRevocationListErrorCode, ParseCertificateRevocationListFailure, ParseCertificateRevocationListResult, ParseOcspRequestErrorCode, ParseOcspRequestFailure, ParseOcspRequestResult, ParseOcspResponseErrorCode, ParseOcspResponseFailure, ParseOcspResponseResult, ParsedCertificateRevocationList, ParsedOcspCertId, ParsedOcspCertStatus, ParsedOcspRequest, ParsedOcspResponderId, ParsedOcspResponse, ParsedOcspSingleResponse, ParsedRevocationReason, ParsedRevokedCertificate, RevocationReason, RevokedCertificateInput, UnrecognizedReasonCodePolicy, UnrecognizedRevocationReason, ValidateCertificateRevocationListFailure, ValidateCertificateRevocationListInput, ValidateCertificateRevocationListResult, ValidateOcspResponseErrorCode, ValidateOcspResponseFailure, ValidateOcspResponseInput, ValidateOcspResponseResult, VerifyCertificateRevocationListSignatureFailure, VerifyCertificateRevocationListSignatureResult, VerifyOcspResponseSignatureFailure, VerifyOcspResponseSignatureResult, checkCertificateRevocationAgainstCrl, createCertificateRevocationList, createOcspRequest, createOcspResponse, hasOcspNoCheckExtension, isCertificateRevoked, parseCertificateRevocationListDer, parseCertificateRevocationListDerOrThrow, parseCertificateRevocationListPem, parseCertificateRevocationListPemOrThrow, parseOcspRequestDer, parseOcspRequestDerOrThrow, parseOcspRequestPem, parseOcspRequestPemOrThrow, parseOcspResponseDer, parseOcspResponseDerOrThrow, parseOcspResponsePem, parseOcspResponsePemOrThrow, revocationReasonFromCode, validateCertificateRevocationList, validateOcspResponse, verifyCertificateRevocationListSignature, verifyOcspResponseSignature };
|
|
234
|
+
export declare function checkCertificateRevocation(callerInput: CheckCertificateRevocationInput): Promise<CheckCertificateRevocationResult>;
|
|
235
|
+
export type { CertificateRevocationListMaterial, CheckCertificateRevocationAgainstCrlErrorCode, CheckCertificateRevocationAgainstCrlFailure, CheckCertificateRevocationAgainstCrlFailureDetails, CheckCertificateRevocationAgainstCrlGoodValue, CheckCertificateRevocationAgainstCrlInput, CheckCertificateRevocationAgainstCrlResult, CheckCertificateRevocationAgainstCrlRevokedValue, CheckCertificateRevocationAgainstCrlValue, CreateCertificateRevocationListInput, CreateOcspCertStatusInput, CreateOcspRequestInput, CreateOcspRequestItemInput, CreateOcspResponseInput, CreateOcspSingleResponseInput, CrlApplicabilityFailureReason, CrlCertificateSource, CrlEncoderErrorCode, CrlSource, OcspCertStatus, OcspCertificateSource, OcspEncoderErrorCode, OcspHashAlgorithm, OcspRequestMaterial, OcspRequestSource, OcspResponderRevocationPolicy, OcspResponseMaterial, OcspResponseStatus, ParseCertificateRevocationListErrorCode, ParseCertificateRevocationListFailure, ParseCertificateRevocationListResult, ParseOcspRequestErrorCode, ParseOcspRequestFailure, ParseOcspRequestResult, ParseOcspResponseErrorCode, ParseOcspResponseFailure, ParseOcspResponseResult, ParsedCertificateRevocationList, ParsedOcspCertId, ParsedOcspCertStatus, ParsedOcspRequest, ParsedOcspResponderId, ParsedOcspResponse, ParsedOcspSingleResponse, ParsedRevocationReason, ParsedRevokedCertificate, RevocationReason, RevocationSkipReason, RevokedCertificateInput, SupersededDeltaCrlPolicy, UnrecognizedReasonCodePolicy, UnrecognizedRevocationReason, ValidateCertificateRevocationListFailure, ValidateCertificateRevocationListInput, ValidateCertificateRevocationListResult, ValidateOcspResponseErrorCode, ValidateOcspResponseFailure, ValidateOcspResponseInput, ValidateOcspResponseResult, VerifyCertificateRevocationListSignatureFailure, VerifyCertificateRevocationListSignatureOptions, VerifyCertificateRevocationListSignatureResult, VerifyOcspResponseSignatureFailure, VerifyOcspResponseSignatureOptions, VerifyOcspResponseSignatureResult, checkCertificateRevocationAgainstCrl, createCertificateRevocationList, createOcspRequest, createOcspResponse, hasOcspNoCheckExtension, isCertificateRevoked, parseCertificateRevocationListDer, parseCertificateRevocationListDerOrThrow, parseCertificateRevocationListPem, parseCertificateRevocationListPemOrThrow, parseOcspRequestDer, parseOcspRequestDerOrThrow, parseOcspRequestPem, parseOcspRequestPemOrThrow, parseOcspResponseDer, parseOcspResponseDerOrThrow, parseOcspResponsePem, parseOcspResponsePemOrThrow, revocationReasonFromCode, validateCertificateRevocationList, validateOcspResponse, verifyCertificateRevocationListSignature, verifyOcspResponseSignature };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { decodeRefusalOf as e } from "../internal/asn1/decode-refusal.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { callerVerification as t, resolveSignatureVerifiers as n } from "../internal/crypto/sig-verify.js";
|
|
3
|
+
import { DECODE_REFUSAL_CODES as r, rethrowIfInvariant as i } from "../result/result.js";
|
|
4
|
+
import { assertClockSkew as a, assertCrlMaxAge as o, checkCertificateRevocationAgainstCrlsBy as s, coversAllDistributionPointReasons as c, distinctSignedCrls as l, normalizeCrl as u, revocationReasonFromCode as d, signedCrlKey as f } from "./crl.js";
|
|
5
|
+
import { validateOcspResponseWith as p } from "./ocsp.js";
|
|
6
|
+
import { parseCertificateDerOrThrow as m, parseCertificateFromSource as h } from "../x509/parse.js";
|
|
6
7
|
// src/revocation/revocation.ts
|
|
7
8
|
/**
|
|
8
9
|
* Revocation orchestration: evaluates CRL and OCSP evidence to produce a
|
|
@@ -11,11 +12,14 @@ import { parseCertificateDerOrThrow as c, parseCertificateFromSource as l } from
|
|
|
11
12
|
* @module
|
|
12
13
|
*/
|
|
13
14
|
/** Every {@linkcode RevocationIndeterminateReasonCode}, as a runtime array. */
|
|
14
|
-
const
|
|
15
|
+
const g = [
|
|
15
16
|
"certificate_status_missing",
|
|
16
17
|
"certificate_status_unknown",
|
|
17
18
|
"crl_sign_not_permitted",
|
|
19
|
+
"delta_crl_retry_limit_exceeded",
|
|
20
|
+
"delta_crl_unusable",
|
|
18
21
|
"issuer_mismatch",
|
|
22
|
+
"malformed",
|
|
19
23
|
"next_update_missing",
|
|
20
24
|
"non_applicable",
|
|
21
25
|
"nonce_mismatch",
|
|
@@ -74,8 +78,25 @@ function resolveOcspResponderCandidates(e) {
|
|
|
74
78
|
}
|
|
75
79
|
/**
|
|
76
80
|
* Evaluates all provided CRL and OCSP evidence to determine the certificate's
|
|
77
|
-
* revocation status. Returns the first `revoked` if any
|
|
78
|
-
*
|
|
81
|
+
* revocation status. Returns the first `revoked` if any. Otherwise an OCSP
|
|
82
|
+
* `good` settles the status, then a CRL `good` once the CRLs together cover
|
|
83
|
+
* every revocation reason, else `indeterminate` with diagnostic details about
|
|
84
|
+
* each indeterminate evidence.
|
|
85
|
+
* Each CRL in `evidence` counts as a delta CRL when it carries the delta CRL
|
|
86
|
+
* indicator and as a complete CRL otherwise, whichever field holds it. Each
|
|
87
|
+
* distinct complete CRL is checked once, updated by the newest delta CRL
|
|
88
|
+
* among them that applies to it, as `checkChainRevocation` does, within the
|
|
89
|
+
* same attempt limits, which the CRL checks of delegated OCSP responders
|
|
90
|
+
* share. A delta CRL that cannot settle the status records
|
|
91
|
+
* `delta_crl_unusable` in `details.indeterminateEvidence`, and a candidate
|
|
92
|
+
* the limits leave unread that counts under `unreadSupersededDeltaCrls`
|
|
93
|
+
* records `delta_crl_retry_limit_exceeded` there; either keeps other evidence
|
|
94
|
+
* from settling the status as `good`. Unless other evidence revokes the
|
|
95
|
+
* certificate, the result is then `indeterminate` with the top-level code
|
|
96
|
+
* `revocation_status_indeterminate`.
|
|
97
|
+
* A certificate carrying noRevAvail is `skipped` without consulting evidence
|
|
98
|
+
* (RFC 9608 §4). One carrying id-pkix-ocsp-nocheck is still checked against
|
|
99
|
+
* the evidence, which may list it as revoked.
|
|
79
100
|
*
|
|
80
101
|
* @example
|
|
81
102
|
* ```ts
|
|
@@ -92,41 +113,49 @@ function resolveOcspResponderCandidates(e) {
|
|
|
92
113
|
* ```
|
|
93
114
|
*/
|
|
94
115
|
async function checkCertificateRevocation(e) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
116
|
+
let t = {
|
|
117
|
+
...e,
|
|
118
|
+
at: e.at ?? /* @__PURE__ */ new Date()
|
|
119
|
+
};
|
|
120
|
+
o(t.crlMaxAgeMs), a(t.clockSkewMs), n(t.signatureVerifiers);
|
|
121
|
+
let r = t.evidence ?? [], i = r.map((e) => e.kind);
|
|
122
|
+
if (carriesNoRevAvail(t.certificate)) return revocationSuccess({
|
|
123
|
+
status: "skipped",
|
|
124
|
+
skipReason: "no_rev_avail",
|
|
125
|
+
message: "Certificate carries noRevAvail, so no revocation evidence applies"
|
|
126
|
+
});
|
|
127
|
+
if (r.length === 0) return revocationSuccess({
|
|
98
128
|
status: "indeterminate",
|
|
99
129
|
code: "revocation_evidence_missing",
|
|
100
130
|
message: "No CRL or OCSP evidence provided",
|
|
101
131
|
details: {
|
|
102
|
-
checkedSources:
|
|
132
|
+
checkedSources: i,
|
|
103
133
|
indeterminateEvidence: []
|
|
104
134
|
}
|
|
105
135
|
});
|
|
106
|
-
let
|
|
136
|
+
let s;
|
|
107
137
|
try {
|
|
108
|
-
|
|
138
|
+
s = normalizeCertificate(t.certificate);
|
|
109
139
|
} catch (e) {
|
|
110
|
-
return undecodableCertificateResult(e,
|
|
140
|
+
return undecodableCertificateResult(e, i);
|
|
111
141
|
}
|
|
112
|
-
let
|
|
113
|
-
for (let
|
|
114
|
-
|
|
115
|
-
if (
|
|
116
|
-
|
|
117
|
-
if (t.coveredReasons === void 0) a ??= t.result;
|
|
142
|
+
let c, l, u = /* @__PURE__ */ new Set(), d = [];
|
|
143
|
+
for (let e of await checkRevocationEvidence(t, r, s)) {
|
|
144
|
+
if (e.status === "revoked") return revocationSuccess(e.result);
|
|
145
|
+
if (e.status === "good") {
|
|
146
|
+
if (e.coveredReasons === void 0) c ??= e.result;
|
|
118
147
|
else {
|
|
119
|
-
|
|
120
|
-
for (let
|
|
148
|
+
l ??= e.result;
|
|
149
|
+
for (let t of e.coveredReasons) u.add(t);
|
|
121
150
|
}
|
|
122
|
-
} else
|
|
151
|
+
} else d.push(e.detail);
|
|
123
152
|
}
|
|
124
|
-
return settleRevocationEvidence(
|
|
153
|
+
return settleRevocationEvidence(c, l, u, d, i);
|
|
125
154
|
}
|
|
126
155
|
/** The result once no evidence revoked the certificate outright. */
|
|
127
156
|
function settleRevocationEvidence(e, t, n, r, i) {
|
|
128
|
-
let
|
|
129
|
-
return e !== void 0 && !
|
|
157
|
+
let a = r.some((e) => e.code === "reason_code_unrecognized" || e.code === "delta_crl_unusable" || e.code === "delta_crl_retry_limit_exceeded");
|
|
158
|
+
return e !== void 0 && !a ? revocationSuccess(e) : t !== void 0 && !a && c(n) ? revocationSuccess(t) : (t !== void 0 && !c(n) && r.push({
|
|
130
159
|
kind: "crl",
|
|
131
160
|
code: "reason_coverage_incomplete",
|
|
132
161
|
message: "CRL evidence covers only some revocation reasons"
|
|
@@ -140,54 +169,122 @@ function settleRevocationEvidence(e, t, n, r, i) {
|
|
|
140
169
|
}
|
|
141
170
|
}));
|
|
142
171
|
}
|
|
143
|
-
function undecodableCertificateResult(
|
|
144
|
-
let i = e(
|
|
172
|
+
function undecodableCertificateResult(t, n) {
|
|
173
|
+
let i = e(t, r);
|
|
145
174
|
return revocationSuccess({
|
|
146
175
|
status: "indeterminate",
|
|
147
|
-
code: i?.code ?? "
|
|
176
|
+
code: i?.code ?? "malformed",
|
|
148
177
|
message: i?.message ?? "Certificate input is malformed",
|
|
149
178
|
details: {
|
|
150
|
-
checkedSources:
|
|
179
|
+
checkedSources: n,
|
|
151
180
|
indeterminateEvidence: []
|
|
152
181
|
}
|
|
153
182
|
});
|
|
154
183
|
}
|
|
155
|
-
|
|
184
|
+
/** The checks of `evidence` in order, up to the first that revokes `certificate`. */
|
|
185
|
+
async function checkRevocationEvidence(e, t, n) {
|
|
186
|
+
let r = t.map((e) => e.kind === "crl" ? parseCrlEvidence(e) : void 0), i = l(r.flatMap((e) => [e?.crl, e?.deltaCrl].flatMap((e) => e?.kind === "parsed" && e.crl.baseCrlNumber !== void 0 ? [e.crl] : []))), a = { remaining: 32 }, o = /* @__PURE__ */ new Set(), s = [];
|
|
187
|
+
for (let [c, l] of t.entries()) {
|
|
188
|
+
let t = l.kind === "ocsp" ? [await checkCertificateRevocationWithOcsp(e, l, n, a)] : await checkCrlEvidenceEntry(r[c], o, (t) => checkCertificateRevocationWithCrl(e, t, i, n, a));
|
|
189
|
+
if (s.push(...t), t.some((e) => e.status === "revoked")) return s;
|
|
190
|
+
}
|
|
191
|
+
return s;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* The checks of one CRL evidence entry: its CRLs that do not decode, then
|
|
195
|
+
* `check` on each complete CRL not in `checked`, up to the first that revokes.
|
|
196
|
+
*/
|
|
197
|
+
async function checkCrlEvidenceEntry(e, t, n) {
|
|
198
|
+
if (e === void 0) return [];
|
|
199
|
+
let r = [e.deltaCrl, e.crl].flatMap((e) => e?.kind === "indeterminate" ? [e.check] : []);
|
|
200
|
+
for (let i of completeCrlsOf(e)) {
|
|
201
|
+
let e = f(i);
|
|
202
|
+
if (t.has(e)) continue;
|
|
203
|
+
t.add(e);
|
|
204
|
+
let a = await n(i);
|
|
205
|
+
if (r.push(a), a.status === "revoked") break;
|
|
206
|
+
}
|
|
207
|
+
return r;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* The CRLs of one evidence entry to check as complete CRLs: its `crl`, and
|
|
211
|
+
* its `deltaCrl` when that carries no delta CRL indicator. A delta CRL in
|
|
212
|
+
* `crl` is still checked, which reports it as no complete CRL.
|
|
213
|
+
*/
|
|
214
|
+
function completeCrlsOf(e) {
|
|
215
|
+
return [...e.crl.kind === "parsed" ? [e.crl.crl] : [], ...e.deltaCrl?.kind === "parsed" && e.deltaCrl.crl.baseCrlNumber === void 0 ? [e.deltaCrl.crl] : []];
|
|
216
|
+
}
|
|
217
|
+
function undecodableEvidence(t, n) {
|
|
218
|
+
i(n);
|
|
219
|
+
let a = e(n, r);
|
|
220
|
+
return {
|
|
221
|
+
status: "indeterminate",
|
|
222
|
+
detail: {
|
|
223
|
+
kind: t,
|
|
224
|
+
code: a?.code ?? "malformed",
|
|
225
|
+
message: a?.message ?? `${t.toUpperCase()} evidence input is malformed`
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
/** A CRL evidence entry's complete and delta CRLs, each decoded on its own. */
|
|
230
|
+
function parseCrlEvidence(e) {
|
|
231
|
+
return {
|
|
232
|
+
crl: parseOneCrl(e.crl),
|
|
233
|
+
deltaCrl: e.deltaCrl === void 0 ? void 0 : parseOneCrl(e.deltaCrl)
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
function parseOneCrl(e) {
|
|
156
237
|
try {
|
|
157
|
-
return i.kind === "crl" ? await checkCertificateRevocationWithCrl(r, i, a) : await checkCertificateRevocationWithOcsp(r, i, a);
|
|
158
|
-
} catch (r) {
|
|
159
|
-
n(r);
|
|
160
|
-
let a = e(r, t);
|
|
161
238
|
return {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
239
|
+
kind: "parsed",
|
|
240
|
+
crl: u(e)
|
|
241
|
+
};
|
|
242
|
+
} catch (e) {
|
|
243
|
+
return {
|
|
244
|
+
kind: "indeterminate",
|
|
245
|
+
check: undecodableEvidence("crl", e)
|
|
168
246
|
};
|
|
169
247
|
}
|
|
170
248
|
}
|
|
171
|
-
/**
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
249
|
+
/**
|
|
250
|
+
* Checks one complete CRL from `evidence`, updated by the newest delta CRL
|
|
251
|
+
* among every delta CRL in `evidence` that applies to it, as chain revocation
|
|
252
|
+
* does. A delta CRL that cannot settle the status yields `delta_crl_unusable`.
|
|
253
|
+
*/
|
|
254
|
+
async function checkCertificateRevocationWithCrl(e, n, r, i, a) {
|
|
255
|
+
let o = await s(i, n, r, {
|
|
256
|
+
kind: "certificate",
|
|
257
|
+
certificate: e.issuerCertificate
|
|
258
|
+
}, {
|
|
178
259
|
...e.at === void 0 ? {} : { at: e.at },
|
|
179
260
|
...e.clockSkewMs === void 0 ? {} : { clockSkewMs: e.clockSkewMs },
|
|
180
261
|
...e.crlMaxAgeMs === void 0 ? {} : { maxAgeMs: e.crlMaxAgeMs },
|
|
181
|
-
...e.unrecognizedReasonCode === void 0 ? {} : { unrecognizedReasonCode: e.unrecognizedReasonCode }
|
|
182
|
-
|
|
183
|
-
|
|
262
|
+
...e.unrecognizedReasonCode === void 0 ? {} : { unrecognizedReasonCode: e.unrecognizedReasonCode },
|
|
263
|
+
...e.unreadSupersededDeltaCrls === void 0 ? {} : { unreadSupersededDeltaCrls: e.unreadSupersededDeltaCrls }
|
|
264
|
+
}, t(e.signatureVerifiers), [a]);
|
|
265
|
+
return o.kind === "checked" ? crlEvidenceCheck(o.result) : {
|
|
266
|
+
status: "indeterminate",
|
|
267
|
+
detail: o.reason === "retry_limit" ? {
|
|
268
|
+
kind: "crl",
|
|
269
|
+
code: "delta_crl_retry_limit_exceeded",
|
|
270
|
+
message: "A delta CRL candidate remained unread after the attempt limit"
|
|
271
|
+
} : {
|
|
272
|
+
kind: "crl",
|
|
273
|
+
code: "delta_crl_unusable",
|
|
274
|
+
message: "An applicable delta CRL could not settle the certificate status"
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
/** The evidence check for one CRL result. */
|
|
279
|
+
function crlEvidenceCheck(e) {
|
|
280
|
+
return e.ok ? e.value.status === "revoked" ? {
|
|
184
281
|
status: "revoked",
|
|
185
282
|
result: {
|
|
186
283
|
status: "revoked",
|
|
187
284
|
kind: "crl",
|
|
188
285
|
message: "Certificate is revoked according to CRL evidence",
|
|
189
|
-
revokedAt:
|
|
190
|
-
...
|
|
286
|
+
revokedAt: e.value.revocationDate,
|
|
287
|
+
...e.value.reasonCode === void 0 ? {} : { revocationReason: e.value.reasonCode }
|
|
191
288
|
}
|
|
192
289
|
} : {
|
|
193
290
|
status: "good",
|
|
@@ -196,50 +293,66 @@ async function checkCertificateRevocationWithCrl(e, t, n) {
|
|
|
196
293
|
kind: "crl",
|
|
197
294
|
message: "Certificate is not revoked according to CRL evidence"
|
|
198
295
|
},
|
|
199
|
-
coveredReasons:
|
|
296
|
+
coveredReasons: e.value.coveredReasons
|
|
200
297
|
} : {
|
|
201
298
|
status: "indeterminate",
|
|
202
299
|
detail: {
|
|
203
300
|
kind: "crl",
|
|
204
|
-
code:
|
|
205
|
-
message:
|
|
206
|
-
...
|
|
301
|
+
code: e.code,
|
|
302
|
+
message: e.message,
|
|
303
|
+
...e.details?.reason === void 0 ? {} : { reason: e.details.reason }
|
|
207
304
|
}
|
|
208
305
|
};
|
|
209
306
|
}
|
|
210
|
-
/**
|
|
211
|
-
|
|
212
|
-
|
|
307
|
+
/** The {@linkcode validateOcspResponseWith} input for one OCSP evidence entry. */
|
|
308
|
+
function ocspEvidenceValidationInput(e, t) {
|
|
309
|
+
return {
|
|
213
310
|
response: t.response,
|
|
214
311
|
issuerCertificate: e.issuerCertificate,
|
|
215
312
|
...t.request === void 0 ? {} : { request: t.request },
|
|
216
313
|
...t.responderCertificate === void 0 ? {} : { responderCertificate: t.responderCertificate },
|
|
217
314
|
...e.at === void 0 ? {} : { at: e.at },
|
|
218
315
|
...e.clockSkewMs === void 0 ? {} : { clockSkewMs: e.clockSkewMs },
|
|
219
|
-
...e.ocspProfile === void 0 ? {} : { profile: e.ocspProfile }
|
|
316
|
+
...e.ocspProfile === void 0 ? {} : { profile: e.ocspProfile },
|
|
317
|
+
...e.ocspResponderRevocation === void 0 ? {} : { responderRevocationPolicy: e.ocspResponderRevocation },
|
|
318
|
+
responderRevocationCrls: (e.evidence ?? []).flatMap((e) => e.kind === "crl" ? e.deltaCrl === void 0 ? [e.crl] : [e.crl, e.deltaCrl] : []),
|
|
319
|
+
...e.crlMaxAgeMs === void 0 ? {} : { responderRevocationCrlMaxAgeMs: e.crlMaxAgeMs },
|
|
320
|
+
...e.unrecognizedReasonCode === void 0 ? {} : { responderRevocationUnrecognizedReasonCode: e.unrecognizedReasonCode },
|
|
321
|
+
...e.unreadSupersededDeltaCrls === void 0 ? {} : { responderRevocationUnreadSupersededDeltaCrls: e.unreadSupersededDeltaCrls },
|
|
322
|
+
...e.signatureVerifiers === void 0 ? {} : { signatureVerifiers: e.signatureVerifiers }
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Evaluates a single OCSP evidence entry via {@linkcode validateOcspResponseWith},
|
|
327
|
+
* spending delta CRL checks of a delegated responder from `budget`.
|
|
328
|
+
*/
|
|
329
|
+
async function checkCertificateRevocationWithOcsp(e, t, r, i) {
|
|
330
|
+
let a = await p(ocspEvidenceValidationInput(e, t), {
|
|
331
|
+
verifiers: n(e.signatureVerifiers),
|
|
332
|
+
deltaBudget: i
|
|
220
333
|
});
|
|
221
|
-
if (!
|
|
334
|
+
if (!a.ok) return {
|
|
222
335
|
status: "indeterminate",
|
|
223
336
|
detail: {
|
|
224
337
|
kind: "ocsp",
|
|
225
|
-
code:
|
|
226
|
-
message:
|
|
338
|
+
code: a.code,
|
|
339
|
+
message: a.message
|
|
227
340
|
}
|
|
228
341
|
};
|
|
229
|
-
let
|
|
230
|
-
return
|
|
342
|
+
let o = a.value.responses?.find((e) => normalizeHex(e.certId.serialNumberHex) === normalizeHex(r.serialNumberHex));
|
|
343
|
+
return o === void 0 ? {
|
|
231
344
|
status: "indeterminate",
|
|
232
345
|
detail: {
|
|
233
346
|
kind: "ocsp",
|
|
234
347
|
code: "certificate_status_missing",
|
|
235
348
|
message: "OCSP response does not include certificate status for the target certificate"
|
|
236
349
|
}
|
|
237
|
-
} :
|
|
350
|
+
} : o.certStatus === "revoked" ? e.unrecognizedReasonCode === "reject" && typeof d(o.revocationReasonCode) == "object" ? {
|
|
238
351
|
status: "indeterminate",
|
|
239
352
|
detail: {
|
|
240
353
|
kind: "ocsp",
|
|
241
354
|
code: "reason_code_unrecognized",
|
|
242
|
-
message: `OCSP response carries unrecognized reason code ${String(
|
|
355
|
+
message: `OCSP response carries unrecognized reason code ${String(o.revocationReasonCode)}`
|
|
243
356
|
}
|
|
244
357
|
} : {
|
|
245
358
|
status: "revoked",
|
|
@@ -247,10 +360,10 @@ async function checkCertificateRevocationWithOcsp(e, t, n) {
|
|
|
247
360
|
status: "revoked",
|
|
248
361
|
kind: "ocsp",
|
|
249
362
|
message: "Certificate is revoked according to OCSP evidence",
|
|
250
|
-
...
|
|
251
|
-
...
|
|
363
|
+
...o.revokedAt === void 0 ? {} : { revokedAt: o.revokedAt },
|
|
364
|
+
...o.revocationReasonCode === void 0 ? {} : { revocationReasonCode: o.revocationReasonCode }
|
|
252
365
|
}
|
|
253
|
-
} :
|
|
366
|
+
} : o.certStatus === "good" ? {
|
|
254
367
|
status: "good",
|
|
255
368
|
result: {
|
|
256
369
|
status: "good",
|
|
@@ -268,7 +381,15 @@ async function checkCertificateRevocationWithOcsp(e, t, n) {
|
|
|
268
381
|
}
|
|
269
382
|
/** Accepts PEM, DER, or already-parsed certificate and returns a parsed certificate. */
|
|
270
383
|
function normalizeCertificate(e) {
|
|
271
|
-
return hasParsedCertificateShape(e) ?
|
|
384
|
+
return hasParsedCertificateShape(e) ? m(new Uint8Array(e.der)) : h(e);
|
|
385
|
+
}
|
|
386
|
+
/** Whether `source` parses and carries noRevAvail in its signed DER. */
|
|
387
|
+
function carriesNoRevAvail(e) {
|
|
388
|
+
try {
|
|
389
|
+
return normalizeCertificate(e).noRevAvail === !0;
|
|
390
|
+
} catch (e) {
|
|
391
|
+
return i(e), !1;
|
|
392
|
+
}
|
|
272
393
|
}
|
|
273
394
|
function hasParsedCertificateShape(e) {
|
|
274
395
|
return typeof e != "string" && "subjectPublicKeyInfoDer" in e;
|
|
@@ -284,6 +405,6 @@ function revocationSuccess(e) {
|
|
|
284
405
|
value: e
|
|
285
406
|
};
|
|
286
407
|
}
|
|
287
|
-
export {
|
|
408
|
+
export { g as REVOCATION_INDETERMINATE_REASON_CODES, checkCertificateRevocation, getCertificateOcspResponderUris, resolveOcspResponderCandidates };
|
|
288
409
|
|
|
289
410
|
//# sourceMappingURL=revocation.js.map
|