micro509 0.18.0 → 0.19.0
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 +88 -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 +6 -5
- 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.map +1 -1
- 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.map +1 -1
- 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.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.map +1 -1
- package/dist/kdf/argon2.js.map +1 -1
- package/dist/keys/keys.js.map +1 -1
- package/dist/pem/pem.js.map +1 -1
- package/dist/pkcs/pfx.js.map +1 -1
- package/dist/pkcs/pkcs12-mac.js +1 -1
- 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 +492 -202
- 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 -171
- 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.map +1 -1
- package/dist/x509/fingerprint.js.map +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 +11 -11
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { SignatureVerifiers } from "../internal/crypto/sig-verify.js";
|
|
1
2
|
import { DecodeFailureCode } from "../result/result.js";
|
|
2
|
-
import { CrlSource, ParsedRevocationReason, UnrecognizedReasonCodePolicy } from "./crl.js";
|
|
3
|
-
import { OcspResponderRevocationPolicy, ValidateOcspResponseInput } from "./ocsp.js";
|
|
3
|
+
import { CrlSource, ParsedRevocationReason, SupersededDeltaCrlPolicy, UnrecognizedReasonCodePolicy } from "./crl.js";
|
|
4
|
+
import { OcspResponderRevocationPolicy, RevocationSkipReason, ValidateOcspResponseInput } from "./ocsp.js";
|
|
4
5
|
import { RevocationCertificateSource } from "./revocation.js";
|
|
6
|
+
import { TrustAnchor } from "../verify/verify.js";
|
|
5
7
|
import { ParsedCertificate } from "../x509/parse.js";
|
|
6
8
|
/**
|
|
7
9
|
* OCSP response in any supported format.
|
|
@@ -53,22 +55,23 @@ export interface RevocationPolicy {
|
|
|
53
55
|
/**
|
|
54
56
|
* Revocation policy for delegated OCSP responder certificates
|
|
55
57
|
* (RFC 6960 §4.2.2.2.1). Supplied CRLs double as responder revocation
|
|
56
|
-
* evidence. Defaults to `'
|
|
58
|
+
* evidence. Defaults to `'nocheck-or-evidence'`.
|
|
57
59
|
*/
|
|
58
60
|
readonly ocspResponderRevocation?: OcspResponderRevocationPolicy;
|
|
59
61
|
/**
|
|
60
62
|
* Maximum age of a CRL's `thisUpdate` at the evaluation time, in
|
|
61
|
-
* milliseconds. An older CRL
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
* required recency of revocation data to
|
|
63
|
+
* milliseconds. An older CRL, or one without `nextUpdate` when this is
|
|
64
|
+
* unset, settles only a revocation other than certificateHold of an
|
|
65
|
+
* unexpired certificate (RFC 5280 §5.3.1). Applies to CRLs for chain
|
|
66
|
+
* certificates, CRL signers and delegated OCSP responders. Unbounded by
|
|
67
|
+
* default. RFC 5280 §3.3 leaves the required recency of revocation data to
|
|
68
|
+
* local policy.
|
|
66
69
|
*/
|
|
67
70
|
readonly crlMaxAgeMs?: number;
|
|
68
71
|
/**
|
|
69
72
|
* Clock-skew tolerance in milliseconds for CRL and OCSP `thisUpdate`/
|
|
70
73
|
* `nextUpdate` checks. It also widens `crlMaxAgeMs` by the same amount.
|
|
71
|
-
* Defaults to `0`.
|
|
74
|
+
* Defaults to `0`. Throws `RangeError` when negative or not finite.
|
|
72
75
|
*/
|
|
73
76
|
readonly clockSkewMs?: number;
|
|
74
77
|
/**
|
|
@@ -87,6 +90,26 @@ export interface RevocationPolicy {
|
|
|
87
90
|
* other evidence. Defaults to `'revoked'`.
|
|
88
91
|
*/
|
|
89
92
|
readonly unrecognizedReasonCode?: UnrecognizedReasonCodePolicy;
|
|
93
|
+
/**
|
|
94
|
+
* Whether a CRL that a delegated CRL signer signed may establish that
|
|
95
|
+
* signer's own status. RFC 5280 §6.3.3 (f) and X.509 (2019) §9.1.5 leave
|
|
96
|
+
* it open.
|
|
97
|
+
*
|
|
98
|
+
* - `'delegated'`: only when the signer's cRLDistributionPoints names the
|
|
99
|
+
* signer as cRLIssuer, the delegation PKITS 4.14.30 validates (default)
|
|
100
|
+
* - `'any'`: any such CRL that covers the signer, such as one under its
|
|
101
|
+
* issuer's name signed with the signer's separate CRL key
|
|
102
|
+
*
|
|
103
|
+
* A revocation of the signer in such a CRL counts under either value.
|
|
104
|
+
*/
|
|
105
|
+
readonly crlSignerSelfEvidence?: "delegated" | "any";
|
|
106
|
+
/**
|
|
107
|
+
* Treatment of delta CRLs that the attempt limits leave unread although
|
|
108
|
+
* one already read supersedes them, for the chain, its CRL signers and its
|
|
109
|
+
* delegated OCSP responders. See {@linkcode SupersededDeltaCrlPolicy}.
|
|
110
|
+
* Defaults to `'indeterminate'`.
|
|
111
|
+
*/
|
|
112
|
+
readonly unreadSupersededDeltaCrls?: SupersededDeltaCrlPolicy;
|
|
90
113
|
}
|
|
91
114
|
/** Input for {@linkcode checkChainRevocation}. */
|
|
92
115
|
export interface CheckChainRevocationInput {
|
|
@@ -109,6 +132,35 @@ export interface CheckChainRevocationInput {
|
|
|
109
132
|
readonly at?: Date;
|
|
110
133
|
/** Revocation policy. */
|
|
111
134
|
readonly policy?: RevocationPolicy;
|
|
135
|
+
/**
|
|
136
|
+
* Caller verifiers for signature algorithms micro509 does not verify through
|
|
137
|
+
* WebCrypto, keyed by dotted-decimal signature algorithm OID, for CRL and OCSP
|
|
138
|
+
* signatures and the signer paths checked here. A CRL or OCSP signer inside
|
|
139
|
+
* `chain` verifies with the key parameters it inherits along `chain`
|
|
140
|
+
* (RFC 5280 §6.1.4 (e)). A key that micro509 verifies natively, a key that is
|
|
141
|
+
* no OID, or a value that is no function throws `RangeError`.
|
|
142
|
+
*/
|
|
143
|
+
readonly signatureVerifiers?: SignatureVerifiers;
|
|
144
|
+
/**
|
|
145
|
+
* SHA-256 hashes of complete DER SubjectPublicKeyInfo values to distrust in
|
|
146
|
+
* the certification paths of CRL signers and delegated OCSP responders
|
|
147
|
+
* outside `chain`. Supply 64 hexadecimal characters per hash
|
|
148
|
+
* (case-insensitive, no separators). Defaults to an empty list. Malformed
|
|
149
|
+
* entries throw RangeError. A signer whose path carries one yields no
|
|
150
|
+
* evidence.
|
|
151
|
+
*/
|
|
152
|
+
readonly distrustedSpkiSha256?: readonly string[];
|
|
153
|
+
/**
|
|
154
|
+
* The bare trust anchor that issued the last certificate of `chain`, when
|
|
155
|
+
* the path ends below one (RFC 5280 §6.1.1 (d)). The last certificate is
|
|
156
|
+
* then certificate 1 of the path and is checked too (RFC 5280 §6.1.3
|
|
157
|
+
* (a)(3)), with the anchor as its issuer: its key signs CRLs and OCSP
|
|
158
|
+
* responses and certifies delegated signers (X.509 (2019) §7.5). Omitted,
|
|
159
|
+
* the last certificate of `chain` is the trust anchor and is not checked. A
|
|
160
|
+
* chain that ends with the anchor's own certificate, or whose last
|
|
161
|
+
* certificate the anchor did not issue, throws `RangeError`.
|
|
162
|
+
*/
|
|
163
|
+
readonly trustAnchor?: TrustAnchor;
|
|
112
164
|
}
|
|
113
165
|
/**
|
|
114
166
|
* Granular reasons why revocation status could not be determined.
|
|
@@ -124,8 +176,9 @@ export interface CheckChainRevocationInput {
|
|
|
124
176
|
* - **Freshness**: `crl_expired`, `ocsp_response_expired`,
|
|
125
177
|
* `ocsp_next_update_missing`
|
|
126
178
|
* - **Delta CRL**: `delta_crl_unusable` when an authenticated, current delta
|
|
127
|
-
* CRL cannot settle the status, `delta_crl_retry_limit_exceeded` when
|
|
128
|
-
*
|
|
179
|
+
* CRL cannot settle the status, `delta_crl_retry_limit_exceeded` when the
|
|
180
|
+
* attempt limits leave a delta CRL candidate unread that counts under
|
|
181
|
+
* `unreadSupersededDeltaCrls`. Either one outranks a
|
|
129
182
|
* `good` verdict from other evidence.
|
|
130
183
|
* - **Reason code**: `crl_reason_code_unrecognized` and
|
|
131
184
|
* `ocsp_reason_code_unrecognized` when evidence revokes the certificate with
|
|
@@ -208,7 +261,7 @@ export type CertificateRevocationStatus = {
|
|
|
208
261
|
* The extension that exempts the certificate: `'no_rev_avail'` for
|
|
209
262
|
* noRevAvail (RFC 9608 §2) or `'ocsp_nocheck'` for id-pkix-ocsp-nocheck.
|
|
210
263
|
*/
|
|
211
|
-
readonly skipReason:
|
|
264
|
+
readonly skipReason: RevocationSkipReason;
|
|
212
265
|
/** Never present on a `skipped` verdict. */
|
|
213
266
|
readonly source?: undefined;
|
|
214
267
|
/** Never present on a `skipped` verdict. */
|
|
@@ -282,7 +335,8 @@ export type CheckChainRevocationResult = {
|
|
|
282
335
|
* Checks revocation status for all certificates in a validated chain.
|
|
283
336
|
*
|
|
284
337
|
* Evaluates CRL and OCSP evidence against each certificate (except the trust
|
|
285
|
-
* anchor
|
|
338
|
+
* anchor at the end of `chain`; with `trustAnchor`, every certificate), applies
|
|
339
|
+
* the revocation policy, and returns a unified decision. A
|
|
286
340
|
* certificate carrying noRevAvail or id-pkix-ocsp-nocheck is reported as
|
|
287
341
|
* `skipped` without consulting evidence (RFC 9608 §4).
|
|
288
342
|
*
|