micro509 0.14.0 → 0.16.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 +2119 -0
- package/README.md +105 -225
- package/dist/crypto/crypto.d.ts +42 -11
- package/dist/crypto/crypto.js +53 -22
- package/dist/crypto/crypto.js.map +1 -1
- package/dist/crypto.d.ts +2 -2
- package/dist/crypto.js +1 -2
- package/dist/der/der.d.ts +41 -33
- package/dist/der/der.js +26 -24
- package/dist/der/der.js.map +1 -1
- package/dist/index.d.ts +11 -11
- package/dist/index.js +19 -19
- package/dist/internal/asn1/asn1.d.ts +3 -6
- package/dist/internal/asn1/asn1.js +343 -43
- package/dist/internal/asn1/asn1.js.map +1 -1
- package/dist/internal/asn1/ber.js +146 -0
- package/dist/internal/asn1/ber.js.map +1 -0
- package/dist/internal/asn1/decode-refusal.js +29 -0
- package/dist/internal/asn1/decode-refusal.js.map +1 -0
- package/dist/internal/asn1/der.d.ts +38 -41
- package/dist/internal/asn1/der.js +131 -52
- package/dist/internal/asn1/der.js.map +1 -1
- package/dist/internal/asn1/oids.js +83 -53
- package/dist/internal/asn1/oids.js.map +1 -1
- package/dist/internal/asn1/oids2.js +1 -2
- package/dist/internal/asn1/oids2.js.map +1 -1
- package/dist/internal/crypto/algorithm-names.js +1 -2
- package/dist/internal/crypto/algorithm-names.js.map +1 -1
- package/dist/internal/crypto/ecdsa.js +13 -8
- package/dist/internal/crypto/ecdsa.js.map +1 -1
- package/dist/internal/crypto/hash.js +1 -2
- package/dist/internal/crypto/hash.js.map +1 -1
- package/dist/internal/crypto/pbes2.d.ts +24 -11
- package/dist/internal/crypto/pbes2.js +79 -26
- package/dist/internal/crypto/pbes2.js.map +1 -1
- package/dist/internal/crypto/rsa-pss.js +46 -44
- package/dist/internal/crypto/rsa-pss.js.map +1 -1
- package/dist/internal/crypto/sig-verify.d.ts +4 -7
- package/dist/internal/crypto/sig-verify.js +107 -60
- package/dist/internal/crypto/sig-verify.js.map +1 -1
- package/dist/internal/crypto/signing.d.ts +1 -4
- package/dist/internal/crypto/signing.js +28 -29
- package/dist/internal/crypto/signing.js.map +1 -1
- package/dist/internal/crypto/webcrypto.js +1 -2
- package/dist/internal/crypto/webcrypto.js.map +1 -1
- package/dist/internal/shared/base64.js +1 -2
- package/dist/internal/shared/base64.js.map +1 -1
- package/dist/internal/shared/dn.d.ts +3 -6
- package/dist/internal/shared/dn.js +99 -53
- package/dist/internal/shared/dn.js.map +1 -1
- package/dist/internal/shared/idna-tables.js +7217 -0
- package/dist/internal/shared/idna-tables.js.map +1 -0
- package/dist/internal/shared/idna.js +296 -0
- package/dist/internal/shared/idna.js.map +1 -0
- package/dist/internal/shared/ip.d.ts +4 -7
- package/dist/internal/shared/ip.js +1 -2
- package/dist/internal/shared/ip.js.map +1 -1
- package/dist/internal/shared/mailbox.js +26 -0
- package/dist/internal/shared/mailbox.js.map +1 -0
- package/dist/internal/shared/punycode.js +101 -0
- package/dist/internal/shared/punycode.js.map +1 -0
- package/dist/internal/shared/rfc3454-tables.js +1 -2
- package/dist/internal/shared/rfc3454-tables.js.map +1 -1
- package/dist/internal/shared/rfc4518-tables.js +119 -0
- package/dist/internal/shared/rfc4518-tables.js.map +1 -0
- package/dist/internal/shared/uri-host.js +102 -0
- package/dist/internal/shared/uri-host.js.map +1 -0
- package/dist/internal/verify/name-constraints-engine.js +246 -131
- package/dist/internal/verify/name-constraints-engine.js.map +1 -1
- package/dist/internal/verify/policy-engine.js +6 -21
- package/dist/internal/verify/policy-engine.js.map +1 -1
- package/dist/internal/verify/spki-distrust.js +23 -0
- package/dist/internal/verify/spki-distrust.js.map +1 -0
- package/dist/internal/verify/verify-path.d.ts +1 -4
- package/dist/internal/verify/verify-path.js +282 -129
- package/dist/internal/verify/verify-path.js.map +1 -1
- package/dist/internal/x509/directory-name.js +1 -2
- package/dist/internal/x509/directory-name.js.map +1 -1
- package/dist/internal/x509/extension-bits.js +2 -3
- package/dist/internal/x509/extension-bits.js.map +1 -1
- package/dist/internal/x509/extension-errors.d.ts +1 -4
- package/dist/internal/x509/extension-errors.js +1 -2
- package/dist/internal/x509/extension-errors.js.map +1 -1
- package/dist/internal/x509/extension-registry.js +107 -89
- package/dist/internal/x509/extension-registry.js.map +1 -1
- package/dist/internal/x509/general-name-profile.js +129 -0
- package/dist/internal/x509/general-name-profile.js.map +1 -0
- package/dist/internal/x509/general-name-tags.js +1 -2
- package/dist/internal/x509/general-name-tags.js.map +1 -1
- package/dist/internal/x509/general-name.js +128 -42
- package/dist/internal/x509/general-name.js.map +1 -1
- package/dist/internal/x509/name-fields.js +1 -2
- package/dist/internal/x509/name-fields.js.map +1 -1
- package/dist/internal/x509/or-address.js +217 -0
- package/dist/internal/x509/or-address.js.map +1 -0
- package/dist/keys/keys.d.ts +122 -104
- package/dist/keys/keys.js +211 -204
- package/dist/keys/keys.js.map +1 -1
- package/dist/keys.d.ts +3 -3
- package/dist/pem/pem.d.ts +14 -17
- package/dist/pem/pem.js +16 -17
- package/dist/pem/pem.js.map +1 -1
- package/dist/pem.js +1 -2
- package/dist/pkcs/pfx.d.ts +57 -32
- package/dist/pkcs/pfx.js +209 -173
- package/dist/pkcs/pfx.js.map +1 -1
- package/dist/pkcs/pkcs12-mac.d.ts +104 -27
- package/dist/pkcs/pkcs12-mac.js +266 -79
- package/dist/pkcs/pkcs12-mac.js.map +1 -1
- package/dist/pkcs/pkcs7.d.ts +43 -37
- package/dist/pkcs/pkcs7.js +218 -217
- package/dist/pkcs/pkcs7.js.map +1 -1
- package/dist/pkcs.d.ts +4 -3
- package/dist/result/result.d.ts +27 -20
- package/dist/result/result.js +8 -3
- package/dist/result/result.js.map +1 -1
- package/dist/result.d.ts +2 -2
- package/dist/result.js +1 -2
- package/dist/revocation/chain.d.ts +101 -23
- package/dist/revocation/chain.js +436 -182
- package/dist/revocation/chain.js.map +1 -1
- package/dist/revocation/crl.d.ts +131 -67
- package/dist/revocation/crl.js +443 -327
- package/dist/revocation/crl.js.map +1 -1
- package/dist/revocation/ocsp.d.ts +94 -59
- package/dist/revocation/ocsp.js +331 -293
- package/dist/revocation/ocsp.js.map +1 -1
- package/dist/revocation/revocation.d.ts +47 -35
- package/dist/revocation/revocation.js +88 -57
- package/dist/revocation/revocation.js.map +1 -1
- package/dist/revocation.d.ts +3 -3
- package/dist/verify/identity.d.ts +16 -19
- package/dist/verify/identity.js +118 -89
- package/dist/verify/identity.js.map +1 -1
- package/dist/verify/name-constraints.d.ts +1 -4
- package/dist/verify/policy.d.ts +9 -7
- package/dist/verify/verify.d.ts +115 -46
- package/dist/verify/verify.js +373 -183
- package/dist/verify/verify.js.map +1 -1
- package/dist/verify.d.ts +2 -2
- package/dist/x509/certificate.d.ts +20 -21
- package/dist/x509/certificate.js +62 -46
- package/dist/x509/certificate.js.map +1 -1
- package/dist/x509/csr.d.ts +5 -7
- package/dist/x509/csr.js +10 -11
- package/dist/x509/csr.js.map +1 -1
- package/dist/x509/extensions.d.ts +154 -66
- package/dist/x509/extensions.js +317 -151
- package/dist/x509/extensions.js.map +1 -1
- package/dist/x509/fingerprint.d.ts +15 -7
- package/dist/x509/fingerprint.js +20 -3
- package/dist/x509/fingerprint.js.map +1 -1
- package/dist/x509/name-text.d.ts +7 -9
- package/dist/x509/name-text.js +18 -4
- package/dist/x509/name-text.js.map +1 -1
- package/dist/x509/name.d.ts +9 -11
- package/dist/x509/name.js +18 -19
- package/dist/x509/name.js.map +1 -1
- package/dist/x509/parse.d.ts +84 -69
- package/dist/x509/parse.js +421 -400
- package/dist/x509/parse.js.map +1 -1
- package/dist/x509.d.ts +3 -3
- package/dist/x509.js +3 -3
- package/package.json +76 -59
package/dist/x509/parse.d.ts
CHANGED
|
@@ -1,29 +1,37 @@
|
|
|
1
|
-
import { ErrorResult, Micro509Error } from "../result/result.js";
|
|
1
|
+
import { DecodeFailureCode, DecodeRefusalCode, ErrorResult, Micro509Error } from "../result/result.js";
|
|
2
2
|
import { ImportKeyResult, PublicKeyImportInput } from "../keys/keys.js";
|
|
3
3
|
import { NameFieldKey } from "./name.js";
|
|
4
4
|
import { AuthorityInformationAccess, BasicConstraints, CertificatePolicies, DistributionPointReason, ExtendedKeyUsage, GeneralName, GeneralSubtree, InhibitAnyPolicy, KeyUsage, NameConstraints, ParsedBitFlags, ParsedNameConstraintForm, PolicyConstraints, PolicyMappings, SubjectAltName } from "./extensions.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Machine-readable failure reason for {@linkcode parseCertificateDer} / {@linkcode parseCertificatePem}.
|
|
7
|
+
*
|
|
8
|
+
* `malformed` is input that breaks DER, ASN.1 or the RFC 5280 profile.
|
|
9
|
+
* `unsupported` is input the profile may allow but micro509 does not decode: a
|
|
10
|
+
* TeletexString octet outside the X.690 §8.23.5.2 initial state.
|
|
11
|
+
* `limit_exceeded` is an implementation limit: an OBJECT IDENTIFIER
|
|
12
|
+
* sub-identifier encoded in more than 64 octets, a tag number of 2^53 or more,
|
|
13
|
+
* or DER nested deeper than 64 levels.
|
|
14
|
+
*/
|
|
15
|
+
export type ParseCertificateErrorCode = DecodeFailureCode;
|
|
8
16
|
/** Structured failure payload for certificate parsing. */
|
|
9
|
-
interface ParseCertificateFailure extends Micro509Error<ParseCertificateErrorCode> {
|
|
17
|
+
export interface ParseCertificateFailure extends Micro509Error<ParseCertificateErrorCode> {
|
|
10
18
|
/** Always `false` for failures. */
|
|
11
19
|
readonly ok: false;
|
|
12
20
|
}
|
|
13
21
|
/** Success-or-failure result from {@linkcode parseCertificateDer} / {@linkcode parseCertificatePem}. */
|
|
14
|
-
type ParseCertificateResult<TMap extends ExtensionDecoderMap = Record<never, never>> = {
|
|
22
|
+
export type ParseCertificateResult<TMap extends ExtensionDecoderMap = Record<never, never>> = {
|
|
15
23
|
readonly ok: true;
|
|
16
24
|
readonly value: ParsedCertificate<TMap>;
|
|
17
25
|
} | ErrorResult<ParseCertificateErrorCode, Record<never, never>, ParseCertificateFailure>;
|
|
18
26
|
/** Success-or-failure result from {@linkcode parseCertificateChainPem}. */
|
|
19
|
-
type ParseCertificateChainResult<TMap extends ExtensionDecoderMap = Record<never, never>> = {
|
|
27
|
+
export type ParseCertificateChainResult<TMap extends ExtensionDecoderMap = Record<never, never>> = {
|
|
20
28
|
readonly ok: true;
|
|
21
29
|
readonly value: readonly ParsedCertificate<TMap>[];
|
|
22
30
|
} | ErrorResult<ParseCertificateErrorCode, Record<never, never>, ParseCertificateFailure>;
|
|
23
|
-
/** Machine-readable failure reason for the CSR parsers. */
|
|
24
|
-
type ParseCertificateSigningRequestErrorCode =
|
|
31
|
+
/** Machine-readable failure reason for the CSR parsers, with the codes of {@linkcode ParseCertificateErrorCode}. */
|
|
32
|
+
export type ParseCertificateSigningRequestErrorCode = ParseCertificateErrorCode;
|
|
25
33
|
/** Structured failure payload for CSR parsing. */
|
|
26
|
-
interface ParseCertificateSigningRequestFailure extends Micro509Error<ParseCertificateSigningRequestErrorCode> {
|
|
34
|
+
export interface ParseCertificateSigningRequestFailure extends Micro509Error<ParseCertificateSigningRequestErrorCode> {
|
|
27
35
|
/** Always `false` for failures. */
|
|
28
36
|
readonly ok: false;
|
|
29
37
|
}
|
|
@@ -31,7 +39,7 @@ interface ParseCertificateSigningRequestFailure extends Micro509Error<ParseCerti
|
|
|
31
39
|
* Success-or-failure result from {@linkcode parseCertificateSigningRequestDer} /
|
|
32
40
|
* {@linkcode parseCertificateSigningRequestPem}.
|
|
33
41
|
*/
|
|
34
|
-
type ParseCertificateSigningRequestResult<TMap extends ExtensionDecoderMap = Record<never, never>> = {
|
|
42
|
+
export type ParseCertificateSigningRequestResult<TMap extends ExtensionDecoderMap = Record<never, never>> = {
|
|
35
43
|
readonly ok: true;
|
|
36
44
|
readonly value: ParsedCertificateSigningRequest<TMap>;
|
|
37
45
|
} | ErrorResult<ParseCertificateSigningRequestErrorCode, Record<never, never>, ParseCertificateSigningRequestFailure>;
|
|
@@ -42,7 +50,7 @@ type ParseCertificateSigningRequestResult<TMap extends ExtensionDecoderMap = Rec
|
|
|
42
50
|
*
|
|
43
51
|
* @see {@link https://datatracker.ietf.org/doc/html/rfc5280#appendix-A.1 RFC 5280 Appendix A.1}
|
|
44
52
|
*/
|
|
45
|
-
interface ParsedNameAttribute {
|
|
53
|
+
export interface ParsedNameAttribute {
|
|
46
54
|
/** Dotted-decimal OID of the attribute type (e.g. `"2.5.4.3"` for CN). */
|
|
47
55
|
readonly oid: string;
|
|
48
56
|
/** Friendly key when the OID maps to a well-known field (CN, O, etc.). */
|
|
@@ -58,7 +66,7 @@ interface ParsedNameAttribute {
|
|
|
58
66
|
* Provides three views of the same data: ordered RDNs, a flat attribute
|
|
59
67
|
* list, and a convenience key-value map for well-known fields.
|
|
60
68
|
*/
|
|
61
|
-
interface ParsedName {
|
|
69
|
+
export interface ParsedName {
|
|
62
70
|
/** Hex-encoded DER of the complete Name SEQUENCE, usable for byte-exact comparisons. */
|
|
63
71
|
readonly derHex: string;
|
|
64
72
|
/** Ordered list of RelativeDistinguishedNames, preserving multi-valued RDN structure. */
|
|
@@ -69,7 +77,7 @@ interface ParsedName {
|
|
|
69
77
|
readonly values: Readonly<Partial<Record<NameFieldKey, string>>>;
|
|
70
78
|
}
|
|
71
79
|
/** A single RelativeDistinguishedName SET from an X.501 Name. */
|
|
72
|
-
interface ParsedRelativeDistinguishedName {
|
|
80
|
+
export interface ParsedRelativeDistinguishedName {
|
|
73
81
|
/** Hex-encoded DER of this RDN SET element. */
|
|
74
82
|
readonly derHex: string;
|
|
75
83
|
/** Attributes within this RDN (usually one, but multi-valued RDNs are legal). */
|
|
@@ -82,7 +90,7 @@ interface ParsedRelativeDistinguishedName {
|
|
|
82
90
|
* `DistributionPointName ::= CHOICE { fullName [0] GeneralNames,
|
|
83
91
|
* nameRelativeToCRLIssuer [1] RelativeDistinguishedName }`.
|
|
84
92
|
*/
|
|
85
|
-
type ParsedDistributionPointName = {
|
|
93
|
+
export type ParsedDistributionPointName = {
|
|
86
94
|
/** The `fullName [0]` alternative. */
|
|
87
95
|
readonly type: "fullName";
|
|
88
96
|
/** Absolute GeneralName(s) identifying the distribution point. */
|
|
@@ -94,7 +102,7 @@ type ParsedDistributionPointName = {
|
|
|
94
102
|
readonly relativeName: ParsedRelativeDistinguishedName;
|
|
95
103
|
};
|
|
96
104
|
/** A decoded DistributionPoint from the CRL Distribution Points extension. */
|
|
97
|
-
interface ParsedDistributionPoint {
|
|
105
|
+
export interface ParsedDistributionPoint {
|
|
98
106
|
/** Where to fetch the CRL — a fullName URI or relativeName. */
|
|
99
107
|
readonly distributionPoint?: ParsedDistributionPointName;
|
|
100
108
|
/** Revocation reason subset this distribution point covers. Absent means all reasons. */
|
|
@@ -106,9 +114,9 @@ interface ParsedDistributionPoint {
|
|
|
106
114
|
* Decoded Issuing Distribution Point CRL extension (RFC 5280 §5.2.5).
|
|
107
115
|
* Constrains which certificates a CRL covers (scope, reasons, indirection).
|
|
108
116
|
*/
|
|
109
|
-
type ParsedIssuingDistributionPoint = ParsedIssuingDistributionPointBase & ParsedIssuingDistributionPointScope;
|
|
117
|
+
export type ParsedIssuingDistributionPoint = ParsedIssuingDistributionPointBase & ParsedIssuingDistributionPointScope;
|
|
110
118
|
/** Scope-independent fields of a decoded Issuing Distribution Point. */
|
|
111
|
-
interface ParsedIssuingDistributionPointBase {
|
|
119
|
+
export interface ParsedIssuingDistributionPointBase {
|
|
112
120
|
/** Where to fetch this CRL, if specified. */
|
|
113
121
|
readonly distributionPoint?: ParsedDistributionPointName;
|
|
114
122
|
/** Limits the CRL to these revocation reasons. Absent means all reasons. */
|
|
@@ -124,7 +132,7 @@ interface ParsedIssuingDistributionPointBase {
|
|
|
124
132
|
* A flag is absent when the encoding omitted it and `false` when the encoding
|
|
125
133
|
* carried an explicit FALSE.
|
|
126
134
|
*/
|
|
127
|
-
type ParsedIssuingDistributionPointScope = {
|
|
135
|
+
export type ParsedIssuingDistributionPointScope = {
|
|
128
136
|
/** No scope restriction; this CRL covers every certificate kind. */
|
|
129
137
|
readonly onlyContainsUserCerts?: false;
|
|
130
138
|
/** No scope restriction. */
|
|
@@ -154,7 +162,7 @@ type ParsedIssuingDistributionPointScope = {
|
|
|
154
162
|
readonly onlyContainsAttributeCerts: true;
|
|
155
163
|
};
|
|
156
164
|
/** A raw X.509v3 extension before type-specific decoding. */
|
|
157
|
-
interface ParsedExtension {
|
|
165
|
+
export interface ParsedExtension {
|
|
158
166
|
/** Dotted-decimal OID identifying this extension. */
|
|
159
167
|
readonly oid: string;
|
|
160
168
|
/** Whether a validator MUST reject the certificate if it cannot process this extension. */
|
|
@@ -170,7 +178,7 @@ interface ParsedExtension {
|
|
|
170
178
|
* Register with {@linkcode ParseOptions.decoders} or {@linkcode ParseOptions.decoderMap}
|
|
171
179
|
* to decode custom extensions during parsing.
|
|
172
180
|
*/
|
|
173
|
-
interface ExtensionDecoder<TValue> {
|
|
181
|
+
export interface ExtensionDecoder<TValue> {
|
|
174
182
|
/** OID this decoder handles. */
|
|
175
183
|
readonly oid: string;
|
|
176
184
|
/** Decode the raw {@linkcode ParsedExtension} into a typed value. */
|
|
@@ -182,20 +190,20 @@ interface ExtensionDecoder<TValue> {
|
|
|
182
190
|
* @param decoder Decoder definition to return unchanged.
|
|
183
191
|
* @returns The same decoder, properly typed.
|
|
184
192
|
*/
|
|
185
|
-
declare function defineExtensionDecoder<TValue>(decoder: ExtensionDecoder<TValue>): ExtensionDecoder<TValue>;
|
|
193
|
+
export declare function defineExtensionDecoder<TValue>(decoder: ExtensionDecoder<TValue>): ExtensionDecoder<TValue>;
|
|
186
194
|
/**
|
|
187
195
|
* Identity helper that narrows the type of a custom {@linkcode ExtensionDecoderMap} literal.
|
|
188
196
|
*
|
|
189
197
|
* @param decoderMap Map of named decoders to return unchanged.
|
|
190
198
|
* @returns The same map, properly typed.
|
|
191
199
|
*/
|
|
192
|
-
declare function defineExtensionDecoderMap<TMap extends ExtensionDecoderMap>(decoderMap: TMap): TMap;
|
|
200
|
+
export declare function defineExtensionDecoderMap<TMap extends ExtensionDecoderMap>(decoderMap: TMap): TMap;
|
|
193
201
|
/** String-keyed map of {@linkcode ExtensionDecoder}s, used with {@linkcode ParseOptions.decoderMap}. */
|
|
194
|
-
type ExtensionDecoderMap = Record<string, ExtensionDecoder<unknown>>;
|
|
202
|
+
export type ExtensionDecoderMap = Record<string, ExtensionDecoder<unknown>>;
|
|
195
203
|
/** Inferred result type when decoding extensions via an {@linkcode ExtensionDecoderMap}. */
|
|
196
|
-
type DecodedExtensionMap<TMap extends ExtensionDecoderMap> = { [TKey in keyof TMap]?: TMap[TKey] extends ExtensionDecoder<infer TValue> ? DecodedExtensionValue<TValue> : never; };
|
|
204
|
+
export type DecodedExtensionMap<TMap extends ExtensionDecoderMap> = { [TKey in keyof TMap]?: TMap[TKey] extends ExtensionDecoder<infer TValue> ? DecodedExtensionValue<TValue> : never; };
|
|
197
205
|
/** A successfully decoded extension value paired with its OID and criticality. */
|
|
198
|
-
interface DecodedExtensionValue<TValue> {
|
|
206
|
+
export interface DecodedExtensionValue<TValue> {
|
|
199
207
|
/** Dotted-decimal OID of the decoded extension. */
|
|
200
208
|
readonly oid: string;
|
|
201
209
|
/** Whether the extension was marked critical in the certificate. */
|
|
@@ -210,7 +218,7 @@ interface DecodedExtensionValue<TValue> {
|
|
|
210
218
|
* Supply custom extension decoders to have their results included in the parsed output alongside
|
|
211
219
|
* the built-in extensions.
|
|
212
220
|
*/
|
|
213
|
-
interface ParseOptions<TMap extends ExtensionDecoderMap = Record<never, never>> {
|
|
221
|
+
export interface ParseOptions<TMap extends ExtensionDecoderMap = Record<never, never>> {
|
|
214
222
|
/** Array of decoders; decoded values appear in `decodedExtensions`. */
|
|
215
223
|
readonly decoders?: readonly ExtensionDecoder<unknown>[];
|
|
216
224
|
/** Named decoder map; decoded values appear in `decodedExtensionMap` keyed by map key. */
|
|
@@ -223,7 +231,7 @@ interface ParseOptions<TMap extends ExtensionDecoderMap = Record<never, never>>
|
|
|
223
231
|
* typed fields automatically.\
|
|
224
232
|
* Supply {@linkcode ParseOptions} to also decode custom extensions.
|
|
225
233
|
*/
|
|
226
|
-
interface ParsedCertificate<TMap extends ExtensionDecoderMap = Record<never, never>> {
|
|
234
|
+
export interface ParsedCertificate<TMap extends ExtensionDecoderMap = Record<never, never>> {
|
|
227
235
|
/** Complete DER encoding of the certificate (copied from the input). */
|
|
228
236
|
readonly der: Uint8Array;
|
|
229
237
|
/** X.509 version number (1, 2, or 3). Almost always 3. */
|
|
@@ -284,6 +292,8 @@ interface ParsedCertificate<TMap extends ExtensionDecoderMap = Record<never, nev
|
|
|
284
292
|
readonly authorityInfoAccess?: readonly AuthorityInformationAccess[];
|
|
285
293
|
/** Decoded CRL Distribution Points (RFC 5280 §4.2.1.13). */
|
|
286
294
|
readonly crlDistributionPoints?: readonly ParsedDistributionPoint[];
|
|
295
|
+
/** `true` when the certificate carries No Revocation Available (RFC 9608 §2). */
|
|
296
|
+
readonly noRevAvail?: true;
|
|
287
297
|
/** Custom-decoded extensions from {@linkcode ParseOptions.decoders}. */
|
|
288
298
|
readonly decodedExtensions?: readonly DecodedExtensionValue<unknown>[];
|
|
289
299
|
/** Custom-decoded extensions from {@linkcode ParseOptions.decoderMap}, keyed by map key. */
|
|
@@ -299,7 +309,7 @@ interface ParsedCertificate<TMap extends ExtensionDecoderMap = Record<never, nev
|
|
|
299
309
|
* Extension fields mirror {@linkcode ParsedCertificate} but come from the
|
|
300
310
|
* CSR's extensionRequest attribute rather than the v3 extensions block.
|
|
301
311
|
*/
|
|
302
|
-
interface ParsedCertificateSigningRequest<TMap extends ExtensionDecoderMap = Record<never, never>> {
|
|
312
|
+
export interface ParsedCertificateSigningRequest<TMap extends ExtensionDecoderMap = Record<never, never>> {
|
|
303
313
|
/** PKCS#10 version, normalized to the v1 ordinal `1`. The encoded CertificationRequestInfo version INTEGER is `0` (RFC 2986 §4.1). */
|
|
304
314
|
readonly version: number;
|
|
305
315
|
/** DER encoding of the CertificationRequestInfo, used for signature verification. */
|
|
@@ -348,6 +358,8 @@ interface ParsedCertificateSigningRequest<TMap extends ExtensionDecoderMap = Rec
|
|
|
348
358
|
readonly authorityInfoAccess?: readonly AuthorityInformationAccess[];
|
|
349
359
|
/** Decoded CRL Distribution Points from the extensionRequest attribute. */
|
|
350
360
|
readonly crlDistributionPoints?: readonly ParsedDistributionPoint[];
|
|
361
|
+
/** `true` when the extensionRequest attribute carries No Revocation Available (RFC 9608 §2). */
|
|
362
|
+
readonly noRevAvail?: true;
|
|
351
363
|
/** Custom-decoded extensions from {@linkcode ParseOptions.decoders}. */
|
|
352
364
|
readonly decodedExtensions?: readonly DecodedExtensionValue<unknown>[];
|
|
353
365
|
/** Custom-decoded extensions from {@linkcode ParseOptions.decoderMap}. */
|
|
@@ -364,7 +376,7 @@ interface ParsedCertificateSigningRequest<TMap extends ExtensionDecoderMap = Rec
|
|
|
364
376
|
* @param der Raw DER bytes of an X.509 certificate.
|
|
365
377
|
* @param options Custom extension decoders to apply during parsing.
|
|
366
378
|
*/
|
|
367
|
-
declare function parseCertificateDerOrThrow<TMap extends ExtensionDecoderMap = Record<never, never>>(der: Uint8Array, options?: ParseOptions<TMap>): ParsedCertificate<TMap>;
|
|
379
|
+
export declare function parseCertificateDerOrThrow<TMap extends ExtensionDecoderMap = Record<never, never>>(der: Uint8Array, options?: ParseOptions<TMap>): ParsedCertificate<TMap>;
|
|
368
380
|
/**
|
|
369
381
|
* Decode a DER-encoded X.509 certificate into a {@linkcode ParsedCertificate}.
|
|
370
382
|
*
|
|
@@ -381,7 +393,7 @@ declare function parseCertificateDerOrThrow<TMap extends ExtensionDecoderMap = R
|
|
|
381
393
|
* @param der Raw DER bytes of an X.509 certificate.
|
|
382
394
|
* @param options Custom extension decoders to apply during parsing.
|
|
383
395
|
*/
|
|
384
|
-
declare function parseCertificateDer<TMap extends ExtensionDecoderMap = Record<never, never>>(der: Uint8Array, options?: ParseOptions<TMap>): ParseCertificateResult<TMap>;
|
|
396
|
+
export declare function parseCertificateDer<TMap extends ExtensionDecoderMap = Record<never, never>>(der: Uint8Array, options?: ParseOptions<TMap>): ParseCertificateResult<TMap>;
|
|
385
397
|
/**
|
|
386
398
|
* Decode a PEM-encoded X.509 certificate into a {@linkcode ParsedCertificate}.
|
|
387
399
|
*
|
|
@@ -400,7 +412,7 @@ declare function parseCertificateDer<TMap extends ExtensionDecoderMap = Record<n
|
|
|
400
412
|
* @param pem PEM string with a CERTIFICATE block.
|
|
401
413
|
* @param options Custom extension decoders to apply during parsing.
|
|
402
414
|
*/
|
|
403
|
-
declare function parseCertificatePemOrThrow<TMap extends ExtensionDecoderMap = Record<never, never>>(pem: string, options?: ParseOptions<TMap>): ParsedCertificate<TMap>;
|
|
415
|
+
export declare function parseCertificatePemOrThrow<TMap extends ExtensionDecoderMap = Record<never, never>>(pem: string, options?: ParseOptions<TMap>): ParsedCertificate<TMap>;
|
|
404
416
|
/**
|
|
405
417
|
* Decode a PEM-encoded X.509 certificate into a {@linkcode ParsedCertificate}.
|
|
406
418
|
*
|
|
@@ -413,11 +425,11 @@ declare function parseCertificatePemOrThrow<TMap extends ExtensionDecoderMap = R
|
|
|
413
425
|
* @param pem PEM string with a CERTIFICATE block.
|
|
414
426
|
* @param options Custom extension decoders to apply during parsing.
|
|
415
427
|
*/
|
|
416
|
-
declare function parseCertificatePem<TMap extends ExtensionDecoderMap = Record<never, never>>(pem: string, options?: ParseOptions<TMap>): ParseCertificateResult<TMap>;
|
|
428
|
+
export declare function parseCertificatePem<TMap extends ExtensionDecoderMap = Record<never, never>>(pem: string, options?: ParseOptions<TMap>): ParseCertificateResult<TMap>;
|
|
417
429
|
/** Normalizes a PEM bundle or single DER certificate source into parsed certificates. */
|
|
418
|
-
declare function parseCertificatesFromSource<TMap extends ExtensionDecoderMap = Record<never, never>>(source: string | Uint8Array, options?: ParseOptions<TMap>): readonly ParsedCertificate<TMap>[];
|
|
430
|
+
export declare function parseCertificatesFromSource<TMap extends ExtensionDecoderMap = Record<never, never>>(source: string | Uint8Array, options?: ParseOptions<TMap>): readonly ParsedCertificate<TMap>[];
|
|
419
431
|
/** Normalizes a PEM, DER, or already-parsed certificate source into one parsed certificate. */
|
|
420
|
-
declare function parseCertificateFromSource<TMap extends ExtensionDecoderMap = Record<never, never>>(source: ParsedCertificate<TMap> | string | Uint8Array, options?: ParseOptions<TMap>): ParsedCertificate<TMap>;
|
|
432
|
+
export declare function parseCertificateFromSource<TMap extends ExtensionDecoderMap = Record<never, never>>(source: ParsedCertificate<TMap> | string | Uint8Array, options?: ParseOptions<TMap>): ParsedCertificate<TMap>;
|
|
421
433
|
/**
|
|
422
434
|
* Decode a PEM bundle containing one or more certificates, throwing on malformed input.
|
|
423
435
|
*
|
|
@@ -426,7 +438,7 @@ declare function parseCertificateFromSource<TMap extends ExtensionDecoderMap = R
|
|
|
426
438
|
* @param pemBundle PEM text that may contain multiple CERTIFICATE blocks.
|
|
427
439
|
* @param options Custom extension decoders to apply during parsing.
|
|
428
440
|
*/
|
|
429
|
-
declare function parseCertificateChainPemOrThrow<TMap extends ExtensionDecoderMap = Record<never, never>>(pemBundle: string, options?: ParseOptions<TMap>): readonly ParsedCertificate<TMap>[];
|
|
441
|
+
export declare function parseCertificateChainPemOrThrow<TMap extends ExtensionDecoderMap = Record<never, never>>(pemBundle: string, options?: ParseOptions<TMap>): readonly ParsedCertificate<TMap>[];
|
|
430
442
|
/**
|
|
431
443
|
* Decode a PEM bundle containing one or more certificates.
|
|
432
444
|
*
|
|
@@ -436,35 +448,35 @@ declare function parseCertificateChainPemOrThrow<TMap extends ExtensionDecoderMa
|
|
|
436
448
|
* @param pemBundle PEM text that may contain multiple CERTIFICATE blocks.
|
|
437
449
|
* @param options Custom extension decoders to apply during parsing.
|
|
438
450
|
*/
|
|
439
|
-
declare function parseCertificateChainPem<TMap extends ExtensionDecoderMap = Record<never, never>>(pemBundle: string, options?: ParseOptions<TMap>): ParseCertificateChainResult<TMap>;
|
|
451
|
+
export declare function parseCertificateChainPem<TMap extends ExtensionDecoderMap = Record<never, never>>(pemBundle: string, options?: ParseOptions<TMap>): ParseCertificateChainResult<TMap>;
|
|
440
452
|
/**
|
|
441
453
|
* Decode a DER-encoded PKCS#10 CSR into a {@linkcode ParsedCertificateSigningRequest}.
|
|
442
454
|
*
|
|
443
455
|
* @param der Raw DER bytes of a PKCS#10 certificate signing request.
|
|
444
456
|
* @param options Custom extension decoders to apply during parsing.
|
|
445
457
|
*/
|
|
446
|
-
declare function parseCertificateSigningRequestDerOrThrow<TMap extends ExtensionDecoderMap = Record<never, never>>(der: Uint8Array, options?: ParseOptions<TMap>): ParsedCertificateSigningRequest<TMap>;
|
|
458
|
+
export declare function parseCertificateSigningRequestDerOrThrow<TMap extends ExtensionDecoderMap = Record<never, never>>(der: Uint8Array, options?: ParseOptions<TMap>): ParsedCertificateSigningRequest<TMap>;
|
|
447
459
|
/**
|
|
448
460
|
* Decode a DER-encoded PKCS#10 CSR into a {@linkcode ParsedCertificateSigningRequest}.
|
|
449
461
|
*
|
|
450
462
|
* @param der Raw DER bytes of a PKCS#10 certificate signing request.
|
|
451
463
|
* @param options Custom extension decoders to apply during parsing.
|
|
452
464
|
*/
|
|
453
|
-
declare function parseCertificateSigningRequestDer<TMap extends ExtensionDecoderMap = Record<never, never>>(der: Uint8Array, options?: ParseOptions<TMap>): ParseCertificateSigningRequestResult<TMap>;
|
|
465
|
+
export declare function parseCertificateSigningRequestDer<TMap extends ExtensionDecoderMap = Record<never, never>>(der: Uint8Array, options?: ParseOptions<TMap>): ParseCertificateSigningRequestResult<TMap>;
|
|
454
466
|
/**
|
|
455
467
|
* Decode a PEM-encoded PKCS#10 CSR into a {@linkcode ParsedCertificateSigningRequest}.
|
|
456
468
|
*
|
|
457
469
|
* @param pem PEM string with a CERTIFICATE REQUEST block.
|
|
458
470
|
* @param options Custom extension decoders to apply during parsing.
|
|
459
471
|
*/
|
|
460
|
-
declare function parseCertificateSigningRequestPemOrThrow<TMap extends ExtensionDecoderMap = Record<never, never>>(pem: string, options?: ParseOptions<TMap>): ParsedCertificateSigningRequest<TMap>;
|
|
472
|
+
export declare function parseCertificateSigningRequestPemOrThrow<TMap extends ExtensionDecoderMap = Record<never, never>>(pem: string, options?: ParseOptions<TMap>): ParsedCertificateSigningRequest<TMap>;
|
|
461
473
|
/**
|
|
462
474
|
* Decode a PEM-encoded PKCS#10 CSR into a {@linkcode ParsedCertificateSigningRequest}.
|
|
463
475
|
*
|
|
464
476
|
* @param pem PEM string with a CERTIFICATE REQUEST block.
|
|
465
477
|
* @param options Custom extension decoders to apply during parsing.
|
|
466
478
|
*/
|
|
467
|
-
declare function parseCertificateSigningRequestPem<TMap extends ExtensionDecoderMap = Record<never, never>>(pem: string, options?: ParseOptions<TMap>): ParseCertificateSigningRequestResult<TMap>;
|
|
479
|
+
export declare function parseCertificateSigningRequestPem<TMap extends ExtensionDecoderMap = Record<never, never>>(pem: string, options?: ParseOptions<TMap>): ParseCertificateSigningRequestResult<TMap>;
|
|
468
480
|
/**
|
|
469
481
|
* Import the subject public key of a parsed certificate or CSR as a WebCrypto `CryptoKey`.
|
|
470
482
|
*
|
|
@@ -493,13 +505,13 @@ declare function parseCertificateSigningRequestPem<TMap extends ExtensionDecoder
|
|
|
493
505
|
*
|
|
494
506
|
* @see {@linkcode getSubjectPublicKey} for the non-throwing variant
|
|
495
507
|
*/
|
|
496
|
-
declare function getSubjectPublicKeyOrThrow<TMap extends ExtensionDecoderMap = Record<never, never>>(parsed: ParsedCertificate<TMap> | ParsedCertificateSigningRequest<TMap>, algorithm?: PublicKeyImportInput): Promise<CryptoKey>;
|
|
508
|
+
export declare function getSubjectPublicKeyOrThrow<TMap extends ExtensionDecoderMap = Record<never, never>>(parsed: ParsedCertificate<TMap> | ParsedCertificateSigningRequest<TMap>, algorithm?: PublicKeyImportInput): Promise<CryptoKey>;
|
|
497
509
|
/**
|
|
498
510
|
* Import the subject public key of a parsed certificate or CSR as a WebCrypto `CryptoKey`.
|
|
499
511
|
*
|
|
500
512
|
* @see `getSubjectPublicKeyOrThrow` for the throwing variant
|
|
501
513
|
*/
|
|
502
|
-
declare function getSubjectPublicKey<TMap extends ExtensionDecoderMap = Record<never, never>>(parsed: ParsedCertificate<TMap> | ParsedCertificateSigningRequest<TMap>, algorithm?: PublicKeyImportInput): Promise<ImportKeyResult<CryptoKey>>;
|
|
514
|
+
export declare function getSubjectPublicKey<TMap extends ExtensionDecoderMap = Record<never, never>>(parsed: ParsedCertificate<TMap> | ParsedCertificateSigningRequest<TMap>, algorithm?: PublicKeyImportInput): Promise<ImportKeyResult<CryptoKey>>;
|
|
503
515
|
/**
|
|
504
516
|
* Check whether a certificate's subject public key belongs to a private key.
|
|
505
517
|
*
|
|
@@ -544,25 +556,25 @@ declare function getSubjectPublicKey<TMap extends ExtensionDecoderMap = Record<n
|
|
|
544
556
|
* @see {@linkcode getSubjectPublicKeyOrThrow} to obtain the certificate's public key directly
|
|
545
557
|
* @see {@linkcode derivePublicKey} for the private-to-public bridge this builds on
|
|
546
558
|
*/
|
|
547
|
-
declare function certificateMatchesPrivateKey<TMap extends ExtensionDecoderMap = Record<never, never>>(certificate: ParsedCertificate<TMap> | string | Uint8Array, privateKey: CryptoKey): Promise<boolean>;
|
|
559
|
+
export declare function certificateMatchesPrivateKey<TMap extends ExtensionDecoderMap = Record<never, never>>(certificate: ParsedCertificate<TMap> | string | Uint8Array, privateKey: CryptoKey): Promise<boolean>;
|
|
548
560
|
/** Machine-readable failure reason for {@linkcode matchCertificatePrivateKey}. */
|
|
549
|
-
type MatchCertificatePrivateKeyErrorCode = "malformed_certificate" | "unsupported_private_key" | "key_type_mismatch" | "key_mismatch";
|
|
561
|
+
export type MatchCertificatePrivateKeyErrorCode = "malformed_certificate" | "unsupported_private_key" | "key_type_mismatch" | "key_mismatch" | DecodeRefusalCode;
|
|
550
562
|
/** Structured failure payload for {@linkcode matchCertificatePrivateKey}. */
|
|
551
|
-
interface MatchCertificatePrivateKeyFailure extends Micro509Error<MatchCertificatePrivateKeyErrorCode> {
|
|
563
|
+
export interface MatchCertificatePrivateKeyFailure extends Micro509Error<MatchCertificatePrivateKeyErrorCode> {
|
|
552
564
|
/** Always `false` for failures. */
|
|
553
565
|
readonly ok: false;
|
|
554
566
|
}
|
|
555
567
|
/** A successful match: the private key's public half is the certificate's subject public key. */
|
|
556
|
-
interface MatchCertificatePrivateKeySuccess {
|
|
568
|
+
export interface MatchCertificatePrivateKeySuccess {
|
|
557
569
|
/** Always `true` for success. */
|
|
558
570
|
readonly ok: true;
|
|
559
571
|
/** No payload on success — the match itself is the signal. */
|
|
560
572
|
readonly value: undefined;
|
|
561
573
|
}
|
|
562
574
|
/** Failure branch of {@linkcode MatchCertificatePrivateKeyResult} with structured error details. */
|
|
563
|
-
type MatchCertificatePrivateKeyFailureResult = ErrorResult<MatchCertificatePrivateKeyErrorCode, Record<never, never>, MatchCertificatePrivateKeyFailure>;
|
|
575
|
+
export type MatchCertificatePrivateKeyFailureResult = ErrorResult<MatchCertificatePrivateKeyErrorCode, Record<never, never>, MatchCertificatePrivateKeyFailure>;
|
|
564
576
|
/** Result of {@linkcode matchCertificatePrivateKey}. */
|
|
565
|
-
type MatchCertificatePrivateKeyResult = MatchCertificatePrivateKeySuccess | MatchCertificatePrivateKeyFailureResult;
|
|
577
|
+
export type MatchCertificatePrivateKeyResult = MatchCertificatePrivateKeySuccess | MatchCertificatePrivateKeyFailureResult;
|
|
566
578
|
/**
|
|
567
579
|
* Check whether a certificate's subject public key belongs to a private key,
|
|
568
580
|
* returning a typed {@linkcode MatchCertificatePrivateKeyResult}.
|
|
@@ -576,6 +588,9 @@ type MatchCertificatePrivateKeyResult = MatchCertificatePrivateKeySuccess | Matc
|
|
|
576
588
|
* one of:
|
|
577
589
|
*
|
|
578
590
|
* - `malformed_certificate` — `certificate` could not be parsed.
|
|
591
|
+
* - `unsupported` or `limit_exceeded` — `certificate` holds a construct
|
|
592
|
+
* micro509 does not decode or exceeds a decoding limit (see
|
|
593
|
+
* {@linkcode ParseCertificateErrorCode}).
|
|
579
594
|
* - `unsupported_private_key` — `privateKey` is not an extractable private key
|
|
580
595
|
* of a supported type (from {@linkcode derivePublicKey}).
|
|
581
596
|
* - `key_type_mismatch` — the key is a different algorithm than the
|
|
@@ -596,13 +611,14 @@ type MatchCertificatePrivateKeyResult = MatchCertificatePrivateKeySuccess | Matc
|
|
|
596
611
|
* if (!result.ok) {
|
|
597
612
|
* // result.code is 'malformed_certificate' | 'unsupported_private_key'
|
|
598
613
|
* // | 'key_type_mismatch' | 'key_mismatch'
|
|
614
|
+
* // | 'unsupported' | 'limit_exceeded'
|
|
599
615
|
* throw new Error(`key does not match certificate: ${result.code}`);
|
|
600
616
|
* }
|
|
601
617
|
* ```
|
|
602
618
|
*
|
|
603
619
|
* @see {@linkcode certificateMatchesPrivateKey} for the plain-boolean variant
|
|
604
620
|
*/
|
|
605
|
-
declare function matchCertificatePrivateKey<TMap extends ExtensionDecoderMap = Record<never, never>>(certificate: ParsedCertificate<TMap> | string | Uint8Array, privateKey: CryptoKey): Promise<MatchCertificatePrivateKeyResult>;
|
|
621
|
+
export declare function matchCertificatePrivateKey<TMap extends ExtensionDecoderMap = Record<never, never>>(certificate: ParsedCertificate<TMap> | string | Uint8Array, privateKey: CryptoKey): Promise<MatchCertificatePrivateKeyResult>;
|
|
606
622
|
/**
|
|
607
623
|
* Find a raw extension by OID within a parsed extension list.
|
|
608
624
|
*
|
|
@@ -610,7 +626,7 @@ declare function matchCertificatePrivateKey<TMap extends ExtensionDecoderMap = R
|
|
|
610
626
|
* @param oid Dotted-decimal OID to look up.
|
|
611
627
|
* @returns The matching extension, or `undefined` if not present.
|
|
612
628
|
*/
|
|
613
|
-
declare function findExtension(extensions: readonly ParsedExtension[], oid: string): ParsedExtension | undefined;
|
|
629
|
+
export declare function findExtension(extensions: readonly ParsedExtension[], oid: string): ParsedExtension | undefined;
|
|
614
630
|
/**
|
|
615
631
|
* Decode a single extension using a custom {@linkcode ExtensionDecoder}.
|
|
616
632
|
*
|
|
@@ -618,47 +634,46 @@ declare function findExtension(extensions: readonly ParsedExtension[], oid: stri
|
|
|
618
634
|
* @param decoder Decoder whose OID will be matched.
|
|
619
635
|
* @returns The decoded value, or `undefined` if the extension is absent.
|
|
620
636
|
*/
|
|
621
|
-
declare function decodeExtension<TValue>(extensions: readonly ParsedExtension[], decoder: ExtensionDecoder<TValue>): TValue | undefined;
|
|
637
|
+
export declare function decodeExtension<TValue>(extensions: readonly ParsedExtension[], decoder: ExtensionDecoder<TValue>): TValue | undefined;
|
|
622
638
|
/**
|
|
623
639
|
* Decode all matching extensions using an array of {@linkcode ExtensionDecoder}s.
|
|
624
640
|
*
|
|
625
641
|
* @param extensions Extension list to search.
|
|
626
642
|
* @param decoders Decoders to apply. Only matching OIDs produce output.
|
|
627
643
|
*/
|
|
628
|
-
declare function decodeExtensions(extensions: readonly ParsedExtension[], decoders: readonly ExtensionDecoder<unknown>[]): readonly DecodedExtensionValue<unknown>[];
|
|
644
|
+
export declare function decodeExtensions(extensions: readonly ParsedExtension[], decoders: readonly ExtensionDecoder<unknown>[]): readonly DecodedExtensionValue<unknown>[];
|
|
629
645
|
/**
|
|
630
646
|
* Decode all matching extensions using a named {@linkcode ExtensionDecoderMap}.
|
|
631
647
|
*
|
|
632
648
|
* @param extensions Extension list to search.
|
|
633
649
|
* @param decoderMap Named decoders. Results are keyed by the same map keys.
|
|
634
650
|
*/
|
|
635
|
-
declare function decodeExtensionMap<TMap extends ExtensionDecoderMap>(extensions: readonly ParsedExtension[], decoderMap: TMap): DecodedExtensionMap<TMap>;
|
|
651
|
+
export declare function decodeExtensionMap<TMap extends ExtensionDecoderMap>(extensions: readonly ParsedExtension[], decoderMap: TMap): DecodedExtensionMap<TMap>;
|
|
636
652
|
/** Decodes the Basic Constraints extension value DER. */
|
|
637
|
-
declare function parseBasicConstraints(bytes: Uint8Array): BasicConstraints;
|
|
653
|
+
export declare function parseBasicConstraints(bytes: Uint8Array): BasicConstraints;
|
|
638
654
|
/** Decodes the Key Usage BIT STRING extension value. */
|
|
639
|
-
declare function parseKeyUsage(bytes: Uint8Array): ParsedBitFlags<KeyUsage>;
|
|
655
|
+
export declare function parseKeyUsage(bytes: Uint8Array): ParsedBitFlags<KeyUsage>;
|
|
640
656
|
/** Decodes the Extended Key Usage SEQUENCE OF OIDs. */
|
|
641
|
-
declare function parseExtendedKeyUsage(bytes: Uint8Array): readonly ExtendedKeyUsage[];
|
|
657
|
+
export declare function parseExtendedKeyUsage(bytes: Uint8Array): readonly ExtendedKeyUsage[];
|
|
642
658
|
/** Decodes the Certificate Policies extension value. */
|
|
643
|
-
declare function parseCertificatePolicies(bytes: Uint8Array): CertificatePolicies;
|
|
659
|
+
export declare function parseCertificatePolicies(bytes: Uint8Array): CertificatePolicies;
|
|
644
660
|
/** Decodes the Policy Mappings extension value. */
|
|
645
|
-
declare function parsePolicyMappings(bytes: Uint8Array): PolicyMappings;
|
|
661
|
+
export declare function parsePolicyMappings(bytes: Uint8Array): PolicyMappings;
|
|
646
662
|
/** Decodes the Policy Constraints extension value. */
|
|
647
|
-
declare function parsePolicyConstraints(bytes: Uint8Array): PolicyConstraints;
|
|
663
|
+
export declare function parsePolicyConstraints(bytes: Uint8Array): PolicyConstraints;
|
|
648
664
|
/** Decodes the Inhibit anyPolicy extension (single INTEGER). */
|
|
649
|
-
declare function parseInhibitAnyPolicy(bytes: Uint8Array): InhibitAnyPolicy;
|
|
665
|
+
export declare function parseInhibitAnyPolicy(bytes: Uint8Array): InhibitAnyPolicy;
|
|
650
666
|
/** Decodes a subjectAltName or issuerAltName SEQUENCE OF GeneralName. */
|
|
651
|
-
declare function parseSubjectAltNames(bytes: Uint8Array, label?: string): readonly SubjectAltName[];
|
|
667
|
+
export declare function parseSubjectAltNames(bytes: Uint8Array, label?: string): readonly SubjectAltName[];
|
|
652
668
|
/** Decodes a bare DER-encoded X.501 Name, as carried in a `directoryName` GeneralName. */
|
|
653
|
-
declare function parseDistinguishedNameDer(bytes: Uint8Array): ParsedName;
|
|
669
|
+
export declare function parseDistinguishedNameDer(bytes: Uint8Array): ParsedName;
|
|
654
670
|
/** Decodes the Authority Information Access extension value. */
|
|
655
|
-
declare function parseAuthorityInfoAccess(bytes: Uint8Array): readonly AuthorityInformationAccess[];
|
|
671
|
+
export declare function parseAuthorityInfoAccess(bytes: Uint8Array): readonly AuthorityInformationAccess[];
|
|
656
672
|
/** Decodes the CRL Distribution Points extension value. */
|
|
657
|
-
declare function parseCrlDistributionPoints(bytes: Uint8Array): readonly ParsedDistributionPoint[];
|
|
673
|
+
export declare function parseCrlDistributionPoints(bytes: Uint8Array): readonly ParsedDistributionPoint[];
|
|
658
674
|
/** Decodes the Name Constraints extension value. */
|
|
659
|
-
declare function parseNameConstraints(bytes: Uint8Array): NameConstraints<ParsedNameConstraintForm>;
|
|
675
|
+
export declare function parseNameConstraints(bytes: Uint8Array): NameConstraints<ParsedNameConstraintForm>;
|
|
660
676
|
/** Decodes the Authority Key Identifier extension, returning the keyIdentifier hex or undefined. */
|
|
661
|
-
declare function parseAuthorityKeyIdentifier(bytes: Uint8Array): string | undefined;
|
|
662
|
-
|
|
663
|
-
export { DecodedExtensionMap, DecodedExtensionValue, ExtensionDecoder, ExtensionDecoderMap, MatchCertificatePrivateKeyErrorCode, MatchCertificatePrivateKeyFailure, MatchCertificatePrivateKeyFailureResult, MatchCertificatePrivateKeyResult, MatchCertificatePrivateKeySuccess, ParseCertificateChainResult, ParseCertificateErrorCode, ParseCertificateFailure, ParseCertificateResult, ParseCertificateSigningRequestErrorCode, ParseCertificateSigningRequestFailure, ParseCertificateSigningRequestResult, ParseOptions, type ParsedBitFlags, ParsedCertificate, ParsedCertificateSigningRequest, ParsedDistributionPoint, ParsedDistributionPointName, ParsedExtension, ParsedIssuingDistributionPoint, ParsedIssuingDistributionPointBase, ParsedIssuingDistributionPointScope, ParsedName, ParsedNameAttribute, ParsedRelativeDistinguishedName, certificateMatchesPrivateKey, decodeExtension, decodeExtensionMap, decodeExtensions, defineExtensionDecoder, defineExtensionDecoderMap, findExtension, getSubjectPublicKey, getSubjectPublicKeyOrThrow, matchCertificatePrivateKey, parseAuthorityInfoAccess, parseAuthorityKeyIdentifier, parseBasicConstraints, parseCertificateChainPem, parseCertificateChainPemOrThrow, parseCertificateDer, parseCertificateDerOrThrow, parseCertificateFromSource, parseCertificatePem, parseCertificatePemOrThrow, parseCertificatePolicies, parseCertificateSigningRequestDer, parseCertificateSigningRequestDerOrThrow, parseCertificateSigningRequestPem, parseCertificateSigningRequestPemOrThrow, parseCertificatesFromSource, parseCrlDistributionPoints, parseDistinguishedNameDer, parseExtendedKeyUsage, parseInhibitAnyPolicy, parseKeyUsage, parseNameConstraints, parsePolicyConstraints, parsePolicyMappings, parseSubjectAltNames };
|
|
677
|
+
export declare function parseAuthorityKeyIdentifier(bytes: Uint8Array): string | undefined;
|
|
678
|
+
export type { ParsedBitFlags };
|
|
664
679
|
//# sourceMappingURL=parse.d.ts.map
|